Windows Phone 判断方向

    public static class Utilities
    {
        public static bool IsInLandscape(this PhoneApplicationPage page)
        {
            return !page.IsInPortrait();
        }
        public static bool IsInPortrait(this PhoneApplicationPage page)
        {
            return page.IsInOrientation(PageOrientation.Portrait |
                PageOrientation.PortraitUp | PageOrientation.PortraitDown);
        }
        public static bool IsInOrientation(this PhoneApplicationPage page, PageOrientation testOrientation)
        {
            var orientation = page.Orientation;
            return orientation.IsOrientation(testOrientation);
        }
        public static bool IsOrientation(this PageOrientation orientation, PageOrientation testOrientation)
        {
            return (orientation & testOrientation) > 0;
        }
    }

 

posted @ 2012-10-25 15:07  Savorboard  阅读(305)  评论(0编辑  收藏  举报