Exemplo n.º 1
0
        /// <summary>
        /// Sets the current OS theme using the given HighContrastTheme parameter
        /// </summary>
        /// <param name="theme"></param>
        public static void SetCurrent(HighContrastTheme theme)
        {
            var themes = new List <Theme>(Theme.GetAccessibleThemes());

            var hcTheme = themes.Find((Theme t) =>
            {
                return(string.Equals(t.Name, theme.ToString(), StringComparison.InvariantCultureIgnoreCase));
            });

            if (hcTheme == null)
            {
                throw new NotSupportedException($"Theme {theme.ToString()} is not supported");
            }

            Theme.SetCurrent(hcTheme);
        }