private UIElement GetView(WindowOrientation orientation, IList <WindowOrientation> watchedOrientations) { if (watchedOrientations.Contains(orientation)) { throw new Exception("Orientation redirect loop"); } watchedOrientations.Add(orientation); switch (orientation) { case WindowOrientation.Landscape: return(GetView(_landscapeView, LandscapeViewTemplate, LandscapeOrientationRedirect, watchedOrientations)); case WindowOrientation.Portrait: return(GetView(_portraitView, PortraitViewTemplate, PortraitOrientationRedirect, watchedOrientations)); case WindowOrientation.LargeFilled: return(GetView(_largeFilledView, LargeFilledViewTemplate, LargeFilledOrientationRedirect, watchedOrientations)); case WindowOrientation.SmallFilled: return(GetView(_smallFilledView, SmallFilledViewTemplate, SmallFilledOrientationRedirect, watchedOrientations)); case WindowOrientation.Snapped500: return(GetView(_snapped500View, Snapped500ViewTemplate, Snapped500OrientationRedirect, watchedOrientations)); case WindowOrientation.Snapped320: return(GetView(_snapped320View, Snapped320ViewTemplate, Snapped320OrientationRedirect, watchedOrientations)); default: throw new UnhandledCaseException(typeof(WindowOrientation), CurrentOrientation); } }
private UIElement GetView(UIElement view, DataTemplate viewTemplate, WindowOrientation orientationRedirect, IList <WindowOrientation> watchedOrientations) { if (view != null) { return(view); } if (viewTemplate != null) { return(viewTemplate.LoadContent() as UIElement); } return(GetView(orientationRedirect, watchedOrientations)); }
private UIElement GetView(WindowOrientation orientation) { return(GetView(orientation, new List <WindowOrientation>())); }