Exemple #1
0
        private static void OnIsDefaultChanged(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs e)
        {
            ThemeItemModel themeItemModel = (ThemeItemModel)dependencyObject;

            if (themeItemModel.Theme == null)
            {
                return;
            }
            if ((bool)e.NewValue)
            {
                if (!themeItemModel.Theme.Theme.ThemeItems.Contains(themeItemModel.ThemeItem))
                {
                    return;
                }
                themeItemModel.Theme.Theme.ThemeItems.Remove(themeItemModel.ThemeItem);
            }
            else
            {
                if (themeItemModel.Theme.Theme.ThemeItems.Contains(themeItemModel.ThemeItem))
                {
                    return;
                }
                themeItemModel.Theme.Theme.ThemeItems.Add(themeItemModel.ThemeItem);
            }
        }
Exemple #2
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 #3
0
        private void AddThemeItem(IThemeItem item, bool isDefault)
        {
            ThemeItemModel model;

            if (item is ImageResourceThemeItem)
            {
                model = (ThemeItemModel) new ImageResourceModel(item, this, isDefault);
            }
            else if (item is SoundResourceThemeItem)
            {
                model = (ThemeItemModel) new SoundResourceModel(item, this, isDefault);
            }
            else
            {
                if (item is StartMenuThemeItem || item is AnimationsItem)
                {
                    return;
                }
                model = new ThemeItemModel(item, this, isDefault);
            }
            this.AddThemeItem(model, isDefault);
        }
Exemple #4
0
        private ThemeItemCategoryModel GetCategory(ThemeItemModel item)
        {
            string[] categoryNames = (item.Category ?? string.Empty).Split(new char[1]
            {
                '\\'
            });
            ThemeItemCategoryModel itemCategoryModel1 = (ThemeItemCategoryModel)this;

            for (int index = 0; index < categoryNames.Length; ++index)
            {
                if (categoryNames[index] != string.Empty)
                {
                    int i1 = index;
                    ThemeItemCategoryModel itemCategoryModel2 = Enumerable.FirstOrDefault <ThemeItemCategoryModel>(Enumerable.Where <ThemeItemCategoryModel>(Enumerable.OfType <ThemeItemCategoryModel>((IEnumerable)itemCategoryModel1.Children), (Func <ThemeItemCategoryModel, bool>)(c => c.Name == categoryNames[i1])));
                    if (itemCategoryModel2 == null)
                    {
                        itemCategoryModel2 = item.CreateCategory(categoryNames[index], (ThemeTreeItem)itemCategoryModel1);
                        itemCategoryModel1.Children.Add((ThemeTreeItem)itemCategoryModel2);
                    }
                    itemCategoryModel1 = itemCategoryModel2;
                }
            }
            return(itemCategoryModel1);
        }
Exemple #5
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 #6
0
 private ThemeItemCategoryModel GetCategory(ThemeItemModel item)
 {
     string[] categoryNames = (item.Category ?? string.Empty).Split(new char[1]
       {
     '\\'
       });
     ThemeItemCategoryModel itemCategoryModel1 = (ThemeItemCategoryModel)this;
     for (int index = 0; index < categoryNames.Length; ++index)
     {
         if (categoryNames[index] != string.Empty)
         {
             int i1 = index;
             ThemeItemCategoryModel itemCategoryModel2 = Enumerable.FirstOrDefault<ThemeItemCategoryModel>(Enumerable.Where<ThemeItemCategoryModel>(Enumerable.OfType<ThemeItemCategoryModel>((IEnumerable)itemCategoryModel1.Children), (Func<ThemeItemCategoryModel, bool>)(c => c.Name == categoryNames[i1])));
             if (itemCategoryModel2 == null)
             {
                 itemCategoryModel2 = item.CreateCategory(categoryNames[index], (ThemeTreeItem)itemCategoryModel1);
                 itemCategoryModel1.Children.Add((ThemeTreeItem)itemCategoryModel2);
             }
             itemCategoryModel1 = itemCategoryModel2;
         }
     }
     return itemCategoryModel1;
 }
Exemple #7
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 #8
0
 private void AddThemeItem(IThemeItem item, bool isDefault)
 {
     ThemeItemModel model;
     if (item is ImageResourceThemeItem)
         model = (ThemeItemModel)new ImageResourceModel(item, this, isDefault);
     else if (item is SoundResourceThemeItem)
     {
         model = (ThemeItemModel)new SoundResourceModel(item, this, isDefault);
     }
     else
     {
         if (item is StartMenuThemeItem || item is AnimationsItem)
             return;
         model = new ThemeItemModel(item, this, isDefault);
     }
     this.AddThemeItem(model, isDefault);
 }