Exemple #1
0
        public ColorsItemModel(IThemeItem themeItem, ThemeModel theme, bool isDefault)
            : base(themeItem, theme, isDefault)
        {
            this.Name          = "Colors";
            this.DefaultColors = new ObservableCollection <ColorItemModel>();
            Dictionary <string, ColorItemModel> dictionary = new Dictionary <string, ColorItemModel>();

            this.colorsItem = (ColorsThemeItem)themeItem;
            foreach (ColorItem colorItem in (Collection <ColorItem>) this.colorsItem.DefaultColors)
            {
                ColorItemModel colorItemModel = new ColorItemModel(colorItem);
                dictionary[colorItem.Name] = colorItemModel;
            }
            foreach (ColorItem colorItem in Enumerable.Where <ColorItem>(ColorsThemeItem.GetColors(theme.ThemeManager.BackupCache), (Func <ColorItem, bool>)(c => Enumerable.FirstOrDefault <ColorItemModel>((IEnumerable <ColorItemModel>) this.DefaultColors, (Func <ColorItemModel, bool>)(o => o.Item.Name == c.Name)) == null)))
            {
                ColorItemModel colorItemModel1;
                if (!dictionary.TryGetValue(colorItem.Name, out colorItemModel1))
                {
                    ColorItemModel colorItemModel2 = new ColorItemModel(colorItem);
                    colorItemModel2.DefaultValue = new Color?(colorItem.Color);
                    colorItemModel1            = colorItemModel2;
                    dictionary[colorItem.Name] = colorItemModel1;
                }
                colorItemModel1.DefaultValue = new Color?(colorItem.Color);
            }
            foreach (ColorItemModel colorItemModel in dictionary.Values)
            {
                this.DefaultColors.Add(colorItemModel);
                colorItemModel.PropertyChanged += new PropertyChangedEventHandler(this.ColorItem_PropertyChanged);
            }
            theme.Theme.Saved += new EventHandler(this.Theme_Saved);
        }
Exemple #2
0
 public ThemeItemModel(IThemeItem themeItem, ThemeModel theme, bool isDefault)
 {
     this.ThemeItem = themeItem;
     this.Theme = theme;
     this.Name = themeItem.Name;
     themeItem.IsDirtyChanged += new EventHandler(this.ThemeItem_IsDirtyChanged);
     this.SetValue(ThemeItemModel.IsDefaultPropertyKey, isDefault);
 }
Exemple #3
0
 public ThemeItemModel(IThemeItem themeItem, ThemeModel theme, bool isDefault)
 {
     this.ThemeItem            = themeItem;
     this.Theme                = theme;
     this.Name                 = themeItem.Name;
     themeItem.IsDirtyChanged += new EventHandler(this.ThemeItem_IsDirtyChanged);
     this.SetValue(ThemeItemModel.IsDefaultPropertyKey, isDefault);
 }
Exemple #4
0
        public FontsItemModel(IThemeItem themeItem, ThemeModel theme, bool isDefault)
            : base(themeItem, theme, isDefault)
        {
            this.Name           = "Fonts";
            this.fontsThemeItem = (FontsThemeItem)themeItem;
            this.FontClasses    = new ObservableCollection <FontClassModel>();
            Dictionary <string, FontClassModel> dictionary1 = new Dictionary <string, FontClassModel>();

            foreach (FontClass fontClass in (Collection <FontClass>) this.fontsThemeItem.FontClasses)
            {
                dictionary1[fontClass.Name] = new FontClassModel(fontClass);
            }
            foreach (FontClass fontClass in FontsThemeItem.GetFontClasses(theme.ThemeManager.BackupCache))
            {
                FontClassModel fontClassModel;
                if (!dictionary1.TryGetValue(fontClass.Name, out fontClassModel))
                {
                    fontClassModel = new FontClassModel(fontClass);
                    dictionary1[fontClass.Name] = fontClassModel;
                }
                fontClassModel.DefaultValue = new FontFace(fontClass.FontFace);
            }
            foreach (FontClassModel fontClassModel in dictionary1.Values)
            {
                this.FontClasses.Add(fontClassModel);
                fontClassModel.PropertyChanged += new PropertyChangedEventHandler(this.FontClass_PropertyChanged);
            }
            this.FontOverrides = new ObservableCollection <FontOverrideModel>();
            Dictionary <string, FontOverrideModel> dictionary2 = new Dictionary <string, FontOverrideModel>();

            foreach (FontOverride fontOverride in (Collection <FontOverride>) this.fontsThemeItem.FontOverrides)
            {
                dictionary2[fontOverride.Name] = new FontOverrideModel(fontOverride, this);
            }
            foreach (FontOverride fontOverride in FontsThemeItem.GetFontOverrides(theme.ThemeManager.BackupCache, this.Theme.Theme))
            {
                FontOverrideModel fontOverrideModel;
                if (!dictionary2.TryGetValue(fontOverride.Name, out fontOverrideModel))
                {
                    fontOverrideModel = new FontOverrideModel(fontOverride, this);
                    dictionary2[fontOverride.Name] = fontOverrideModel;
                }
                fontOverrideModel.DefaultValue = fontOverrideModel.Clone(fontOverride);
            }
            foreach (FontOverrideModel fontOverrideModel in dictionary2.Values)
            {
                this.FontOverrides.Add(fontOverrideModel);
                fontOverrideModel.PropertyChanged += new PropertyChangedEventHandler(this.FontOverride_PropertyChanged);
            }
        }
Exemple #5
0
 public FontsItemModel(IThemeItem themeItem, ThemeModel theme, bool isDefault)
     : base(themeItem, theme, isDefault)
 {
     this.Name = "Fonts";
     this.fontsThemeItem = (FontsThemeItem)themeItem;
     this.FontClasses = new ObservableCollection<FontClassModel>();
     Dictionary<string, FontClassModel> dictionary1 = new Dictionary<string, FontClassModel>();
     foreach (FontClass fontClass in (Collection<FontClass>)this.fontsThemeItem.FontClasses)
         dictionary1[fontClass.Name] = new FontClassModel(fontClass);
     foreach (FontClass fontClass in FontsThemeItem.GetFontClasses(theme.ThemeManager.BackupCache))
     {
         FontClassModel fontClassModel;
         if (!dictionary1.TryGetValue(fontClass.Name, out fontClassModel))
         {
             fontClassModel = new FontClassModel(fontClass);
             dictionary1[fontClass.Name] = fontClassModel;
         }
         fontClassModel.DefaultValue = new FontFace(fontClass.FontFace);
     }
     foreach (FontClassModel fontClassModel in dictionary1.Values)
     {
         this.FontClasses.Add(fontClassModel);
         fontClassModel.PropertyChanged += new PropertyChangedEventHandler(this.FontClass_PropertyChanged);
     }
     this.FontOverrides = new ObservableCollection<FontOverrideModel>();
     Dictionary<string, FontOverrideModel> dictionary2 = new Dictionary<string, FontOverrideModel>();
     foreach (FontOverride fontOverride in (Collection<FontOverride>)this.fontsThemeItem.FontOverrides)
         dictionary2[fontOverride.Name] = new FontOverrideModel(fontOverride, this);
     foreach (FontOverride fontOverride in FontsThemeItem.GetFontOverrides(theme.ThemeManager.BackupCache, this.Theme.Theme))
     {
         FontOverrideModel fontOverrideModel;
         if (!dictionary2.TryGetValue(fontOverride.Name, out fontOverrideModel))
         {
             fontOverrideModel = new FontOverrideModel(fontOverride, this);
             dictionary2[fontOverride.Name] = fontOverrideModel;
         }
         fontOverrideModel.DefaultValue = fontOverrideModel.Clone(fontOverride);
     }
     foreach (FontOverrideModel fontOverrideModel in dictionary2.Values)
     {
         this.FontOverrides.Add(fontOverrideModel);
         fontOverrideModel.PropertyChanged += new PropertyChangedEventHandler(this.FontOverride_PropertyChanged);
     }
 }
Exemple #6
0
        private static void UpdateVisibility(ThemeModel themeModel, ThemeTreeItem item)
        {
            ThemeItemModel themeItemModel = item as ThemeItemModel;

            if (themeItemModel != null)
            {
                if (themeModel.HideDefaultItems)
                {
                    themeItemModel.Visibility = themeItemModel.IsDefault ? Visibility.Collapsed : Visibility.Visible;
                }
                else
                {
                    themeItemModel.Visibility = Visibility.Visible;
                }
            }
            else
            {
                ThemeItemCategoryModel itemCategoryModel = item as ThemeItemCategoryModel;
                if (itemCategoryModel == null)
                {
                    return;
                }
                foreach (ThemeTreeItem themeTreeItem in (Collection <ThemeTreeItem>)itemCategoryModel.Children)
                {
                    ThemeModel.UpdateVisibility(themeModel, themeTreeItem);
                }
                if (Enumerable.FirstOrDefault <ThemeTreeItem>((IEnumerable <ThemeTreeItem>)itemCategoryModel.Children, (Func <ThemeTreeItem, bool>)(o => o.Visibility != Visibility.Collapsed)) == null)
                {
                    itemCategoryModel.Visibility = Visibility.Collapsed;
                }
                else
                {
                    itemCategoryModel.Visibility = Visibility.Visible;
                }
            }
        }
Exemple #7
0
 public ImageResourceModel(IThemeItem themeItem, ThemeModel theme, bool isDefault)
     : base(themeItem, theme, isDefault)
 {
 }
Exemple #8
0
 public StartMenuModel(IThemeItem themeItem, ThemeModel theme, bool isDefault)
     : base(themeItem, theme, isDefault)
 {
     this.startMenuItem  = (StartMenuThemeItem)themeItem;
     this.StripTitleFont = new FontOverrideModel(this.startMenuItem.StripTitleFont, theme.FontsItem, "Strip title font");
 }
Exemple #9
0
        private void AddThemeItem(ThemeItemModel model, bool isDefault)
        {
            ThemeItemCategoryModel category = this.GetCategory(model);

            if (Enumerable.FirstOrDefault <ThemeItemModel>(Enumerable.Where <ThemeItemModel>(Enumerable.OfType <ThemeItemModel>((IEnumerable)category.Children), (Func <ThemeItemModel, bool>)(t => ThemeModel.ThemeItemsEqual(t.ThemeItem, model.ThemeItem)))) != null)
            {
                return;
            }
            model.Parent = (ThemeTreeItem)category;
            category.Children.Add((ThemeTreeItem)model);
        }
Exemple #10
0
 public void UpdateVisibility()
 {
     ThemeModel.UpdateVisibility(this, (ThemeTreeItem)this);
 }
Exemple #11
0
 public StartMenuModel(IThemeItem themeItem, ThemeModel theme, bool isDefault)
     : base(themeItem, theme, isDefault)
 {
     this.startMenuItem = (StartMenuThemeItem)themeItem;
     this.StripTitleFont = new FontOverrideModel(this.startMenuItem.StripTitleFont, theme.FontsItem, "Strip title font");
 }
Exemple #12
0
 public BiographyModel(ThemeModel theme)
     : base((IThemeItem) new BiographyModel.BiographyThemeItem(theme.Theme), theme, false)
 {
     this.ThemeItem.BeginInit();
     this.ThemeItem.EndInit();
 }
Exemple #13
0
 public ThemeEditDocument(ThemeModel theme)
 {
     theme.Theme.PropertyChanged += new PropertyChangedEventHandler(this.Theme_PropertyChanged);
     this.Theme = theme;
     this.UpdateDocument();
 }
Exemple #14
0
 public ThemeEditDocument(ThemeModel theme)
 {
     theme.Theme.PropertyChanged += new PropertyChangedEventHandler(this.Theme_PropertyChanged);
     this.Theme = theme;
     this.UpdateDocument();
 }
Exemple #15
0
 public SoundResourceModel(IThemeItem themeItem, ThemeModel theme, bool isDefault)
     : base(themeItem, theme, isDefault)
 {
 }
Exemple #16
0
 private static void UpdateVisibility(ThemeModel themeModel, ThemeTreeItem item)
 {
     ThemeItemModel themeItemModel = item as ThemeItemModel;
     if (themeItemModel != null)
     {
         if (themeModel.HideDefaultItems)
             themeItemModel.Visibility = themeItemModel.IsDefault ? Visibility.Collapsed : Visibility.Visible;
         else
             themeItemModel.Visibility = Visibility.Visible;
     }
     else
     {
         ThemeItemCategoryModel itemCategoryModel = item as ThemeItemCategoryModel;
         if (itemCategoryModel == null)
             return;
         foreach (ThemeTreeItem themeTreeItem in (Collection<ThemeTreeItem>)itemCategoryModel.Children)
             ThemeModel.UpdateVisibility(themeModel, themeTreeItem);
         if (Enumerable.FirstOrDefault<ThemeTreeItem>((IEnumerable<ThemeTreeItem>)itemCategoryModel.Children, (Func<ThemeTreeItem, bool>)(o => o.Visibility != Visibility.Collapsed)) == null)
             itemCategoryModel.Visibility = Visibility.Collapsed;
         else
             itemCategoryModel.Visibility = Visibility.Visible;
     }
 }