Пример #1
0
		private static StateDisplayInfo GetStateDisplayInfo(State state, HttpRequest request)
		{
			bool mobile;
			string displayModes = HttpUtility.HtmlDecode(request.Form[DISPLAY_MODES]);
			StateDisplayInfo stateDisplayInfo = new StateDisplayInfo();
			if (displayModes == null)
			{
				mobile = request.Browser.IsMobileDevice;
				stateDisplayInfo.DisplayModes = mobile ? "Mobile" : string.Empty;
				stateDisplayInfo.IsPostBack = false;
			}
			else
			{
				mobile = StringComparer.OrdinalIgnoreCase.Compare(Regex.Split(displayModes, "\\|")[0], "Mobile") == 0;
				stateDisplayInfo.DisplayModes = displayModes;
				stateDisplayInfo.IsPostBack = true;
			}
			stateDisplayInfo.Page = state.GetPage(mobile);
#if NET40Plus
			stateDisplayInfo.Route = state.GetRoute(mobile);
			stateDisplayInfo.RouteName = state.GetRouteName(mobile);
#endif
			stateDisplayInfo.Masters = state.GetMasters(mobile);
			stateDisplayInfo.Theme = state.GetTheme(mobile);
			return stateDisplayInfo;
		}
Пример #2
0
		private static StateDisplayInfo GetStateDisplayInfo(State state, HttpContextBase context)
		{
			bool mobile;
			string displayModes = HttpUtility.HtmlDecode(context.Request.Form[DISPLAY_MODES]);
			StateDisplayInfo stateDisplayInfo = new StateDisplayInfo();
			if (displayModes == null)
			{
				mobile = new HttpContextWrapper(HttpContext.Current).GetOverriddenBrowser().IsMobileDevice;
				if (DisplayModeProvider.Instance.RequireConsistentDisplayMode && (!mobile || state.MobilePage.Length == 0))
					stateDisplayInfo.DisplayMode = DisplayModeProvider.Instance.Modes.Last();
				stateDisplayInfo.DisplayModes = mobile ? "Mobile" : string.Empty;
				stateDisplayInfo.IsPostBack = false;
			}
			else
			{
				mobile = StringComparer.OrdinalIgnoreCase.Compare(Regex.Split(displayModes, "\\|")[0], "Mobile") == 0;
				stateDisplayInfo.DisplayModes = displayModes;
				stateDisplayInfo.IsPostBack = true;
			}
			stateDisplayInfo.Page = state.GetPage(mobile);
			stateDisplayInfo.Route = state.GetRoute(mobile);
			stateDisplayInfo.RouteName = state.GetRouteName(mobile);
			stateDisplayInfo.Masters = state.GetMasters(mobile);
			stateDisplayInfo.Theme = state.GetTheme(mobile);
			return stateDisplayInfo;
		}