コード例 #1
0
 public ThemeSettingsViewModel LoadTheme(ThemeModel theme)
 {
     ThemeSettingsViewModel result = null;
     try
     {
         if (theme == null)
             theme = DefaultTheme;
         if (theme.Path.StartsWith("/Cleverdock;component/"))
             LoadComponentTheme(theme.Path);
         else
         {
             var xamlPath = Path.Combine(theme.Path, "style.xaml");
             var xaml = XamlHelper.LoadXaml(xamlPath);
             LoadResourceDictionary(xaml);
             var settingsPath = Path.Combine(theme.Path, "theme.json");
             result = GetSettings(settingsPath);
         }
         VMLocator.Main.Theme = theme;
         if (ThemeChanged != null)
             ThemeChanged(this, new ThemeEventArgs(theme));
     }
     catch (Exception ex)
     {
         MessageBox.Show("Theme \"" + theme.Name + "\" failed to load. \n" + ex.Message);
         LoadTheme(DefaultTheme);
     }
     return result;
 }
コード例 #2
0
 public ThemeEventArgs(ThemeModel theme)
 {
     Theme = theme;
 }