Exemple #1
0
        /// <summary>
        /// Resets the standard themes available through the theme settings interface.
        /// </summary>
        /// <param name="themes"></param>
        public void SetDefaultThemes(IThemeInfos themes)
        {
            themes.RemoveAllThemeInfos();

            // Add dark theme resource items
            var resources = new List <Uri>();

            foreach (var item in MetroDarkResources)
            {
                resources.Add(new Uri(item, UriKind.RelativeOrAbsolute));
            }

            themes.AddThemeInfo(MetroDarkThemeName, resources);

            // Add light theme resource items
            resources = new List <Uri>();
            foreach (var item in ThemesManager.MetroResources)
            {
                resources.Add(new Uri(item, UriKind.RelativeOrAbsolute));
            }

            themes.AddThemeInfo(MetroLightThemeName, resources);

            // Add generic theme resource items
            resources = new List <Uri>();
            foreach (var item in ThemesManager.GenericResources)
            {
                resources.Add(new Uri(item, UriKind.RelativeOrAbsolute));
            }

            themes.AddThemeInfo(GenericThemeName, resources);
        }
        /// <summary>
        /// Resets the standard themes available through the theme settings interface.
        /// </summary>
        /// <param name="themes"></param>
        public void SetDefaultThemes(IThemeInfos themes)
        {
            themes.RemoveAllThemeInfos();

            // Add theming models
            themes.AddThemeInfo("Dark", new List <Uri>
            {
                new Uri("/Mlib;component/Themes/DarkTheme.xaml", UriKind.RelativeOrAbsolute)
            });

            themes.AddThemeInfo("Light", new List <Uri>
            {
                new Uri("/Mlib;component/Themes/LightTheme.xaml", UriKind.RelativeOrAbsolute)
            });

            _defaultTheme = themes.GetThemeInfo("Dark");
        }
Exemple #3
0
        /// <summary>
        /// Resets the standard themes available through the theme settings interface.
        /// Method Adds Dark and Light theme infos from MLib - calling applications can
        /// use the AddThemeResources() method to add more resources.
        /// </summary>
        /// <param name="themes">Collection of themeinfos in which Dark and Light themes
        /// with MLib resources should be added.</param>
        /// <param name="removeAllThemeInfos">Determines whether existing collection
        /// of themeinfos is removed before addinng Dark and Light themes.</param>
        public void SetDefaultThemes(IThemeInfos themes,
                                     bool removeAllThemeInfos = true)
        {
            if (removeAllThemeInfos == true)
            {
                themes.RemoveAllThemeInfos();
            }

            // Add theming models
            themes.AddThemeInfo("Dark", new List <Uri>
            {
                new Uri("/Mlib;component/Themes/DarkTheme.xaml", UriKind.RelativeOrAbsolute)
            });

            themes.AddThemeInfo("Light", new List <Uri>
            {
                new Uri("/Mlib;component/Themes/LightTheme.xaml", UriKind.RelativeOrAbsolute)
            });

            SetDefaultTheme(themes, "Dark");
        }