コード例 #1
0
ファイル: ThemeRepository.cs プロジェクト: RichardHaggard/BDC
 public static Theme FindTheme(string themeName, bool fallbackToControlDefault)
 {
     lock (ThemeRepository.lockObject)
     {
         if (string.IsNullOrEmpty(themeName) || themeName == "ControlDefault")
         {
             return(ThemeRepository.ControlDefault);
         }
         if (ThemeRepository.themes.Contains((object)themeName))
         {
             return((Theme)ThemeRepository.themes[(object)themeName]);
         }
         if (ThemeRepository.registeredThemes.Contains((object)themeName))
         {
             RadThemeComponentBase registeredTheme = (RadThemeComponentBase)ThemeRepository.registeredThemes[(object)themeName];
             ThemeRepository.registeredThemes.Remove((object)themeName);
             registeredTheme.Load();
             if (registeredTheme.Site == null && !registeredTheme.IsDesignMode)
             {
                 registeredTheme.Dispose();
             }
             return(ThemeRepository.FindTheme(themeName, fallbackToControlDefault));
         }
         if (fallbackToControlDefault)
         {
             return(ThemeRepository.ControlDefault);
         }
     }
     return((Theme)null);
 }
コード例 #2
0
        private void RemoveStyles(Theme theme)
        {
            Theme theme1 = ThemeRepository.FindTheme(theme.Name);

            foreach (StyleGroup styleGroup1 in theme.StyleGroups)
            {
                for (int index = theme1.StyleGroups.Count - 1; index >= 0; --index)
                {
                    StyleGroup styleGroup2 = theme1.StyleGroups[index];
                    if (styleGroup2.IsCompatible(styleGroup1))
                    {
                        theme1.StyleGroups.Remove(styleGroup2);
                        break;
                    }
                }
            }
            foreach (StyleRepository repository1 in theme.Repositories)
            {
                for (int index = theme1.Repositories.Count - 1; index >= 0; --index)
                {
                    StyleRepository repository2 = theme1.Repositories[index];
                    if (repository2.Key == repository1.Key)
                    {
                        theme1.Repositories.Remove(repository2);
                        break;
                    }
                }
            }
            ThemeResolutionService.RaiseThemeChanged(theme.Name, "");
        }
コード例 #3
0
        public static Theme EnsureThemeRegistered(string themeName)
        {
            Theme theme = ThemeRepository.FindTheme(themeName);

            if (theme == null)
            {
                theme = new Theme(themeName);
                ThemeRepository.Add(theme);
            }
            return(theme);
        }
コード例 #4
0
ファイル: ThemeRepository.cs プロジェクト: RichardHaggard/BDC
 public static void Add(Theme theme, bool replaceExistingStyle)
 {
     lock (ThemeRepository.lockObject)
     {
         string name    = theme.Name;
         char[] chArray = new char[1] {
             ','
         };
         foreach (string str in name.Split(chArray))
         {
             string themeName = str.Trim();
             if (themeName == "*" || themeName == "ControlDefault")
             {
                 if (theme != ThemeRepository.ControlDefault)
                 {
                     if (ThemeRepository.ControlDefault != null)
                     {
                         ThemeRepository.ControlDefault.Combine(theme, true, replaceExistingStyle);
                     }
                     else
                     {
                         ThemeRepository.controlDefault = theme;
                         theme.MergeRepositories();
                     }
                 }
             }
             else
             {
                 Theme theme1 = ThemeRepository.FindTheme(themeName, false);
                 if (theme1 != null)
                 {
                     if (theme != theme1)
                     {
                         theme1.Combine(theme, true, replaceExistingStyle);
                     }
                 }
                 else
                 {
                     theme.MergeRepositories();
                     ThemeRepository.themes.Add((object)themeName, (object)theme);
                 }
             }
         }
     }
     ThemeResolutionService.RaiseThemeChanged(theme.Name, (string)null);
 }
コード例 #5
0
        private void EnsureTheme()
        {
            if (this.theme != null)
            {
                return;
            }
            string themeName = this.ThemeName;

            if (this.EnableApplicationThemeName && !string.IsNullOrEmpty(ThemeResolutionService.ApplicationThemeName))
            {
                themeName = ThemeResolutionService.ApplicationThemeName;
            }
            this.theme = ThemeRepository.FindTheme(themeName);
            if (this.theme == null)
            {
                return;
            }
            ++this.styleVersion;
        }
コード例 #6
0
ファイル: ThemeRepository.cs プロジェクト: RichardHaggard/BDC
 public static Theme FindTheme(string themeName)
 {
     return(ThemeRepository.FindTheme(themeName, true));
 }