Exemplo n.º 1
0
        public static string Private_GetThemeResource(Control c, string resourceName)
        {
            string    text     = string.Empty;
            IThemable themable = c.Page as IThemable;

            text = ThemeManager.GetDefaultThemeName((themable != null) ? themable.FeatureSet : FeatureSet.Admin);
            string        contentDeliveryNetworkEndpoint = ThemeResource.ContentDeliveryNetworkEndpoint;
            int           capacity      = contentDeliveryNetworkEndpoint.Length + ThemeResource.LocalThemesPath.Length + text.Length + 1 + resourceName.Length;
            StringBuilder stringBuilder = new StringBuilder(contentDeliveryNetworkEndpoint, capacity);

            stringBuilder.Append(ThemeResource.LocalThemesPath);
            stringBuilder.Append(text);
            stringBuilder.Append("/");
            stringBuilder.Append(resourceName.ToLower());
            return(c.ResolveUrl(stringBuilder.ToString()));
        }
Exemplo n.º 2
0
        private static void OnThemeChanged(DependencyObject target, DependencyPropertyChangedEventArgs changedEventArgs)
        {
            Theme newTheme = changedEventArgs.NewValue as Theme;

            IThemable themableControl = target as IThemable;

            if (themableControl != null)
            {
                themableControl.ResetTheme();
            }
            else
            {
                Control control = target as Control;
                if (control != null)
                {
                    Telerik.Windows.Controls.Theme.DefaultStyleKeyHelper.SetDefaultStyleKey(
                        control, ThemeResourceKey.GetDefaultStyleKey(newTheme, control.GetType()));
                }
            }
        }
Exemplo n.º 3
0
        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);
            this.EnsureChildControls();
            if (HttpContext.Current.Error != null)
            {
                this.debugInformation = HttpContext.Current.Error.ToTraceString();
                HttpContext.Current.ClearError();
            }
            if (HttpContext.Current.Request.ServerVariables["X-ECP-ERROR"] != null)
            {
                HttpContext.Current.Response.AddHeader("X-ECP-ERROR", HttpContext.Current.Request.ServerVariables["X-ECP-ERROR"]);
            }
            string            text = base.Request.QueryString["cause"] ?? "unexpected";
            ErrorPageContents contentsForErrorType = ErrorPageContents.GetContentsForErrorType(text);
            string            text2 = null;

            if (text == "browsernotsupported")
            {
                string    helpId   = EACHelpId.BrowserNotSupportedHelp.ToString();
                IThemable themable = this.Page as IThemable;
                if (themable != null && themable.FeatureSet == FeatureSet.Options)
                {
                    helpId = OptionsHelpId.OwaOptionsBrowserNotSupportedHelp.ToString();
                }
                text2 = string.Format(contentsForErrorType.ErrorMessageText, HelpUtil.BuildEhcHref(helpId));
            }
            else if (text == "nocookies")
            {
                HttpBrowserCapabilities browser = HttpContext.Current.Request.Browser;
                if (browser != null && browser.IsBrowser("IE"))
                {
                    text2 = string.Format(Strings.CookiesDisabledMessageForIE, HelpUtil.BuildEhcHref(EACHelpId.CookiesDisabledMessageForIE.ToString()));
                }
            }
            else if (text == "liveidmismatch")
            {
                string value = HttpContextExtensions.CurrentUserLiveID();
                if (string.IsNullOrEmpty(value))
                {
                    contentsForErrorType = ErrorPageContents.GetContentsForErrorType("unexpected");
                }
                else
                {
                    string arg = EcpUrl.EcpVDir + "logoff.aspx?src=exch&ru=" + HttpUtility.UrlEncode(HttpContext.Current.GetRequestUrl().OriginalString);
                    text2 = string.Format(contentsForErrorType.ErrorMessageText, HttpContextExtensions.CurrentUserLiveID(), arg);
                }
            }
            else if (text == "verificationfailed")
            {
                text2 = string.Format(contentsForErrorType.ErrorMessageText, EcpUrl.EcpVDir);
            }
            else if (text == "verificationprocessingerror")
            {
                text2 = contentsForErrorType.ErrorMessageText;
            }
            else if (text == "noroles")
            {
                this.ShowSignOutHint   = true;
                this.ShowSignOutLink   = true;
                this.SignOutReturnVdir = "/ecp/";
            }
            else if (text == "cannotaccessoptionswithbeparamorcookie")
            {
                this.ShowSignOutLink   = true;
                this.SignOutReturnVdir = "/owa/";
            }
            if (string.IsNullOrEmpty(text2))
            {
                this.msgText.Text = contentsForErrorType.ErrorMessageText;
            }
            else
            {
                this.msgText.Text = text2;
            }
            base.Title         = contentsForErrorType.PageTitle;
            this.msgTitle.Text = Strings.ErrorTitle(contentsForErrorType.ErrorMessageTitle);
            this.msgCode.Text  = ((int)contentsForErrorType.StatusCode).ToString(CultureInfo.InvariantCulture);
            HttpContext.Current.Response.StatusCode             = (int)contentsForErrorType.StatusCode;
            HttpContext.Current.Response.SubStatusCode          = contentsForErrorType.SubStatusCode;
            HttpContext.Current.Response.TrySkipIisCustomErrors = true;
            this.causeMarker.Text = "<!-- cause:" + contentsForErrorType.CauseMarker + " -->";
        }