Esempio n. 1
0
 public void Apply(IThemeItem themeItem, MediaCenterLibraryCache readCache, MediaCenterLibraryCache writeCache)
 {
     StartMenuThemeItem startMenuThemeItem = (StartMenuThemeItem)themeItem;
     this.UpdateStartMenuCategory(startMenuThemeItem, readCache, writeCache);
     this.UpdateQuickLinks(startMenuThemeItem, readCache, writeCache);
     this.UpdateStartMenuOverlay(startMenuThemeItem, readCache, writeCache);
 }
Esempio n. 2
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);
        }
Esempio n. 3
0
        public void Apply(IThemeItem themeItem, MediaCenterLibraryCache readCache, MediaCenterLibraryCache writeCache)
        {
            ColorsThemeItem colorsThemeItem = (ColorsThemeItem)themeItem;

            if (colorsThemeItem.DefaultColors.Count <= 0)
            {
                return;
            }
            IResourceLibrary resourceLibrary1 = readCache[this.ResourceLibraryName];
            IResourceLibrary resourceLibrary2 = writeCache[this.ResourceLibraryName];
            McmlDocument     mcml             = MediaCenterUtil.GetMcml(resourceLibrary1.GetResource(this.ColorsDocumentName, (object)this.ColorsDocumentResourceType));

            foreach (ColorItem colorItem in (Collection <ColorItem>)colorsThemeItem.DefaultColors)
            {
                string          str      = colorItem.ToString();
                PropertyElement property = mcml.Properties().GetProperty(colorItem.Name);
                if (property == null)
                {
                    XElement xelement = new XElement(mcml.DefaultNamespace + "Color", new object[2]
                    {
                        (object)new XAttribute((XName)"Name", (object)colorItem.Name),
                        (object)new XAttribute((XName)"Color", (object)str)
                    });
                    mcml.Xml.Root.Add((object)xelement);
                }
                else
                {
                    property.Value = str;
                }
            }
            MediaCenterUtil.UpdateMcml(resourceLibrary2.GetResource(this.ColorsDocumentName, (object)this.ColorsDocumentResourceType), mcml);
        }
Esempio n. 4
0
        /// <summary>
        /// Returns the content of the unpublished item.
        /// </summary>
        /// <param name="id"></param>
        /// <param name="type"></param>
        /// <param name="theme"></param>
        /// <returns></returns>
        public virtual ActionResult Content(string id, string type, string theme)
        {
            var mimeGroup = "unsupported";
            var themeInst = _ThemeService.GetTheme(theme);

            IThemeItem item = themeInst.GetUnpublishedItem(id, type);

            var viewModel = new ThemeContent
            {
                Id          = id,
                Type        = type,
                Theme       = theme,
                ContentType = item == null ? "" : item.ContentType
            };

            // Richtigen Editor auswählen...
            if (item != null)
            {
                if (item.ContentType.StartsWith("image/"))
                {
                    mimeGroup = "image";
                }
                else if (new string[] { "text/css", "application/x-javascript", "application/x-liquid-template" }.Contains(item.ContentType))
                {
                    mimeGroup         = "text";
                    viewModel.Content = item.ReadContent();
                }
            }
            else
            {
                mimeGroup = "404";
            }

            return(View(string.Format("Editors/_{0}", mimeGroup), viewModel));
        }
Esempio n. 5
0
 public void Apply(IThemeItem themeItem, MediaCenterLibraryCache readCache, MediaCenterLibraryCache writeCache)
 {
     ColorsThemeItem colorsThemeItem = (ColorsThemeItem)themeItem;
     if (colorsThemeItem.DefaultColors.Count <= 0)
         return;
     IResourceLibrary resourceLibrary1 = readCache[this.ResourceLibraryName];
     IResourceLibrary resourceLibrary2 = writeCache[this.ResourceLibraryName];
     McmlDocument mcml = MediaCenterUtil.GetMcml(resourceLibrary1.GetResource(this.ColorsDocumentName, (object)this.ColorsDocumentResourceType));
     foreach (ColorItem colorItem in (Collection<ColorItem>)colorsThemeItem.DefaultColors)
     {
         string str = colorItem.ToString();
         PropertyElement property = mcml.Properties().GetProperty(colorItem.Name);
         if (property == null)
         {
             XElement xelement = new XElement(mcml.DefaultNamespace + "Color", new object[2]
       {
     (object) new XAttribute((XName) "Name", (object) colorItem.Name),
     (object) new XAttribute((XName) "Color", (object) str)
       });
             mcml.Xml.Root.Add((object)xelement);
         }
         else
             property.Value = str;
     }
     MediaCenterUtil.UpdateMcml(resourceLibrary2.GetResource(this.ColorsDocumentName, (object)this.ColorsDocumentResourceType), mcml);
 }
Esempio n. 6
0
 private void UpdateThemeItemDirty(IThemeItem item)
 {
     if (this.IsDirty || !item.IsDirty)
     {
         return;
     }
     this.IsDirty = true;
 }
Esempio n. 7
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);
 }
Esempio n. 8
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);
 }
 public void Apply(IThemeItem themeItem, MediaCenterLibraryCache readCache, MediaCenterLibraryCache writeCache)
 {
     ResourceThemeItem resourceThemeItem = (ResourceThemeItem)themeItem;
     byte[] data = resourceThemeItem.Save(false);
     if (data == null || data.Length <= 0)
         return;
     ResourceExtensions.Update(writeCache[resourceThemeItem.DllName].GetResource(resourceThemeItem.ResourceName, (object)resourceThemeItem.ResourceType), data);
 }
Esempio n. 10
0
 public void Apply(IThemeItem themeItem, MediaCenterLibraryCache readCache, MediaCenterLibraryCache writeCache)
 {
     if (!((AnimationsItem)themeItem).IsBackgroundAnimationDisabled)
     {
         return;
     }
     this.DisableBackgroundAnimations(readCache, writeCache);
 }
Esempio n. 11
0
        public void Apply(IThemeItem themeItem, MediaCenterLibraryCache readCache, MediaCenterLibraryCache writeCache)
        {
            StartMenuThemeItem startMenuThemeItem = (StartMenuThemeItem)themeItem;

            this.UpdateStartMenuCategory(startMenuThemeItem, readCache, writeCache);
            this.UpdateQuickLinks(startMenuThemeItem, readCache, writeCache);
            this.UpdateStartMenuOverlay(startMenuThemeItem, readCache, writeCache);
        }
Esempio n. 12
0
        public void Apply(IThemeItem themeItem, MediaCenterLibraryCache readCache, MediaCenterLibraryCache writeCache)
        {
            FontsThemeItem   fontsThemeItem   = (FontsThemeItem)themeItem;
            IResourceLibrary resourceLibrary1 = readCache["Microsoft.MediaCenter.Shell.dll"];
            IResourceLibrary resourceLibrary2 = writeCache["Microsoft.MediaCenter.Shell.dll"];
            McmlDocument     mcml1            = MediaCenterUtil.GetMcml(resourceLibrary1.GetResource("FONTNAMES.MCML", (object)this.DocumentResourceType));
            McmlDocument     mcml2            = MediaCenterUtil.GetMcml(resourceLibrary1.GetResource("FONTS.MCML", (object)this.DocumentResourceType));

            foreach (FontClass fontClass in Enumerable.Where <FontClass>((IEnumerable <FontClass>)fontsThemeItem.FontClasses, (Func <FontClass, bool>)(o => o.FontFace != null)))
            {
                string          typefaceName = FontUtilities.GetTypefaceName(themeItem.Theme, fontClass.FontFace);
                PropertyElement property     = mcml1.Properties().GetProperty(fontClass.Name);
                if (property == null)
                {
                    XElement xelement = new XElement(McmlDocument.SystemCoreNamespace + "String", new object[2]
                    {
                        (object)new XAttribute((XName)"Name", (object)fontClass.Name),
                        (object)new XAttribute((XName)"String", (object)typefaceName)
                    });
                    mcml1.Xml.Root.Add((object)xelement);
                }
                else
                {
                    property.Value = typefaceName;
                }
            }
            foreach (XElement xelement in mcml1.Xml.Root.Elements())
            {
                mcml2.Xml.Root.AddFirst((object)xelement);
            }
            MediaCenterUtil.UpdateMcml(resourceLibrary2.GetResource("FONTNAMES.MCML", (object)this.DocumentResourceType), mcml1);
            foreach (FontOverride fontOverride in Enumerable.Where <FontOverride>((IEnumerable <FontOverride>)fontsThemeItem.FontOverrides, (Func <FontOverride, bool>)(o =>
            {
                if (o.FontFace == null)
                {
                    return(o.FontClass != null);
                }
                else
                {
                    return(true);
                }
            })))
            {
                FontElement fontElement = mcml2.Properties().GetProperty(fontOverride.Name) as FontElement;
                if (fontElement == null)
                {
                    XElement xelement = new XElement(mcml2.DefaultNamespace + "Font", (object)new XAttribute((XName)"Name", (object)fontOverride.Name));
                    mcml2.Xml.Root.Add((object)xelement);
                    fontElement = (FontElement)mcml2.Properties().GetProperty(fontOverride.Name);
                }
                McmlUtilities.UpdateFontElement(fontOverride, fontElement, themeItem.Theme);
            }
            foreach (XNode xnode in mcml2.Xml.Root.Elements(mcml2.DefaultNamespace + "Aggregate"))
            {
                xnode.Remove();
            }
            MediaCenterUtil.UpdateMcml(resourceLibrary2.GetResource("FONTS.MCML", (object)this.DocumentResourceType), mcml2);
        }
Esempio n. 13
0
        public void Apply(IThemeItem themeItem, MediaCenterLibraryCache readCache, MediaCenterLibraryCache writeCache)
        {
            ResourceThemeItem resourceThemeItem = (ResourceThemeItem)themeItem;

            byte[] data = resourceThemeItem.Save(false);
            if (data == null || data.Length <= 0)
            {
                return;
            }
            ResourceExtensions.Update(writeCache[resourceThemeItem.DllName].GetResource(resourceThemeItem.ResourceName, (object)resourceThemeItem.ResourceType), data);
        }
Esempio n. 14
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);
            }
        }
Esempio n. 15
0
 public void Apply(IThemeItem themeItem, MediaCenterLibraryCache readCache, MediaCenterLibraryCache writeCache)
 {
     FontsThemeItem fontsThemeItem = (FontsThemeItem)themeItem;
     IResourceLibrary resourceLibrary1 = readCache["Microsoft.MediaCenter.Shell.dll"];
     IResourceLibrary resourceLibrary2 = writeCache["Microsoft.MediaCenter.Shell.dll"];
     McmlDocument mcml1 = MediaCenterUtil.GetMcml(resourceLibrary1.GetResource("FONTNAMES.MCML", (object)this.DocumentResourceType));
     McmlDocument mcml2 = MediaCenterUtil.GetMcml(resourceLibrary1.GetResource("FONTS.MCML", (object)this.DocumentResourceType));
     foreach (FontClass fontClass in Enumerable.Where<FontClass>((IEnumerable<FontClass>)fontsThemeItem.FontClasses, (Func<FontClass, bool>)(o => o.FontFace != null)))
     {
         string typefaceName = FontUtilities.GetTypefaceName(themeItem.Theme, fontClass.FontFace);
         PropertyElement property = mcml1.Properties().GetProperty(fontClass.Name);
         if (property == null)
         {
             XElement xelement = new XElement(McmlDocument.SystemCoreNamespace + "String", new object[2]
       {
     (object) new XAttribute((XName) "Name", (object) fontClass.Name),
     (object) new XAttribute((XName) "String", (object) typefaceName)
       });
             mcml1.Xml.Root.Add((object)xelement);
         }
         else
             property.Value = typefaceName;
     }
     foreach (XElement xelement in mcml1.Xml.Root.Elements())
         mcml2.Xml.Root.AddFirst((object)xelement);
     MediaCenterUtil.UpdateMcml(resourceLibrary2.GetResource("FONTNAMES.MCML", (object)this.DocumentResourceType), mcml1);
     foreach (FontOverride fontOverride in Enumerable.Where<FontOverride>((IEnumerable<FontOverride>)fontsThemeItem.FontOverrides, (Func<FontOverride, bool>)(o =>
     {
         if (o.FontFace == null)
             return o.FontClass != null;
         else
             return true;
     })))
     {
         FontElement fontElement = mcml2.Properties().GetProperty(fontOverride.Name) as FontElement;
         if (fontElement == null)
         {
             XElement xelement = new XElement(mcml2.DefaultNamespace + "Font", (object)new XAttribute((XName)"Name", (object)fontOverride.Name));
             mcml2.Xml.Root.Add((object)xelement);
             fontElement = (FontElement)mcml2.Properties().GetProperty(fontOverride.Name);
         }
         McmlUtilities.UpdateFontElement(fontOverride, fontElement, themeItem.Theme);
     }
     foreach (XNode xnode in mcml2.Xml.Root.Elements(mcml2.DefaultNamespace + "Aggregate"))
         xnode.Remove();
     MediaCenterUtil.UpdateMcml(resourceLibrary2.GetResource("FONTS.MCML", (object)this.DocumentResourceType), mcml2);
 }
Esempio n. 16
0
        private static bool ThemeItemsEqual(IThemeItem item1, IThemeItem item2)
        {
            ImageResourceThemeItem resourceThemeItem1 = item1 as ImageResourceThemeItem;
            ImageResourceThemeItem resourceThemeItem2 = item2 as ImageResourceThemeItem;

            if (resourceThemeItem1 == null || resourceThemeItem2 == null)
            {
                return(item1 == item2);
            }
            if (resourceThemeItem1.ResourceName == resourceThemeItem2.ResourceName && resourceThemeItem1.ResourceType == resourceThemeItem2.ResourceType)
            {
                return(resourceThemeItem1.DllName == resourceThemeItem2.DllName);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 17
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);
     }
 }
Esempio n. 18
0
        public static Color ExtractFillColorFromThemeItem(IThemeItem item)
        {
            Color c = Color.Empty;

            if (item == null)
            {
                return(c);
            }

            VectorStyle vectorStyle;
            SolidBrush  solidBrush;

            if ((vectorStyle = item.Style as VectorStyle) != null && (solidBrush = vectorStyle.Fill as SolidBrush) != null)
            {
                c = solidBrush.Color;
            }


            return(c);
        }
Esempio n. 19
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);
        }
Esempio n. 20
0
 protected virtual void Apply(MediaCenterLibraryCache readCache, MediaCenterLibraryCache writeCache, ProgressEnabledOperation operation)
 {
     try
     {
         if (this.Fonts.Count > 0)
         {
             operation.OnProgress("Installing fonts...", 0);
             foreach (string file in Enumerable.Distinct <string>(Enumerable.Select <FontFamily, string>(Enumerable.Where <FontFamily>((IEnumerable <FontFamily>) this.Fonts, (Func <FontFamily, bool>)(f => !Enumerable.Any <FontFamily>((IEnumerable <FontFamily>)System.Windows.Media.Fonts.SystemFontFamilies, (Func <FontFamily, bool>)(o => FontUtil.GetName(f) == FontUtil.GetName(o))))), (Func <FontFamily, string>)(o => FontUtil.GetFile(o)))))
             {
                 FontUtil.InstallFont(file);
             }
         }
         List <IThemeItem> list = Enumerable.ToList <IThemeItem>(Enumerable.Concat <IThemeItem>((IEnumerable <IThemeItem>) new List <IThemeItem>()
         {
             (IThemeItem)this.FontsItem,
             (IThemeItem)this.ColorsItem
         }, (IEnumerable <IThemeItem>) this.ThemeItems));
         for (int currentIndex = 0; currentIndex < list.Count; ++currentIndex)
         {
             IThemeItem themeItem = list[currentIndex];
             operation.OnProgress(string.Format("Applying {0}...", (object)themeItem.Name), currentIndex);
             try
             {
                 themeItem.Apply(readCache, writeCache);
             }
             catch (ThemeApplicationException ex)
             {
                 Trace.TraceWarning(((object)ex).ToString());
             }
         }
     }
     catch (Exception ex)
     {
         Trace.TraceError(((object)ex).ToString());
         operation.OnAbandoned(ex);
         throw;
     }
     operation.OnCompleted();
 }
Esempio n. 21
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);
 }
Esempio n. 22
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");
 }
Esempio n. 23
0
 public SoundResourceModel(IThemeItem themeItem, ThemeModel theme, bool isDefault)
     : base(themeItem, theme, isDefault)
 {
 }
Esempio n. 24
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");
 }
Esempio n. 25
0
 private static string GetStyle(IThemeItem themeItem)
 {
     return GetStyleConverter().ConvertToString(themeItem.Style);
 }
Esempio n. 26
0
 public ImageResourceModel(IThemeItem themeItem, ThemeModel theme, bool isDefault)
     : base(themeItem, theme, isDefault)
 {
 }
Esempio n. 27
0
        public VmcStudioTheme(string file)
            : base(file, FileMode.Open)
        {
            ZipEntry entry1 = this.ZipFile.GetEntry("Theme.xml");

            if (entry1 == null)
            {
                Trace.TraceError("Could not find Theme.xml in theme " + file);
                throw new Exception("Could not find theme entry in theme file.");
            }
            else
            {
                this.themeInfo = (VmcStudioTheme.ThemeInfo) new XmlSerializer(typeof(VmcStudioTheme.ThemeInfo)).Deserialize(this.ZipFile.GetInputStream(entry1));
                this.themeInfo.BeginInit();
                if (this.themeInfo.Fonts == null)
                {
                    this.themeInfo.Fonts = new FontsThemeItem();
                }
                this.themeInfo.Fonts.ClearDirty();
                this.FontsItem = this.themeInfo.Fonts;
                if (this.themeInfo.Colors == null)
                {
                    this.themeInfo.Colors = new ColorsThemeItem();
                }
                this.themeInfo.Colors.ClearDirty();
                this.ColorsItem = this.themeInfo.Colors;
                this.Name       = this.themeInfo.Name;
                this.Author     = this.themeInfo.Author;
                this.Version    = new Version(this.themeInfo.Version);
                this.Comments   = this.themeInfo.Comments;
                this.ThemeType  = this.themeInfo.ThemeType;
                this.ID         = this.themeInfo.ID;
                foreach (ZipEntry entry2 in this.ZipFile)
                {
                    IThemeItem index    = (IThemeItem)null;
                    string[]   strArray = entry2.Name.Split(new char[2]
                    {
                        '\\',
                        '/'
                    });
                    if (strArray[0] == "Resources")
                    {
                        string dllName      = strArray[1] + ".dll";
                        string str          = strArray[2];
                        string resourceName = strArray[3];
                        switch (str)
                        {
                        case "Images":
                            index = (IThemeItem) new ImageResourceThemeItem(dllName, resourceName, (Func <ResourceThemeItem, byte[]>)(themeItem => ZippedTheme.ReadZipEntry(this.ZipFile, this.themeItemEntries[(IThemeItem)themeItem])));
                            break;

                        case "Sounds":
                            index = (IThemeItem) new SoundResourceThemeItem(dllName, resourceName, (Func <ResourceThemeItem, byte[]>)(themeItem => ZippedTheme.ReadZipEntry(this.ZipFile, this.themeItemEntries[(IThemeItem)themeItem])));
                            break;
                        }
                    }
                    else if (strArray[0] == "Fonts")
                    {
                        this.fontEntries.Add(entry2);
                    }
                    else if (entry2.Name == "Screenshot.png")
                    {
                        this.MainScreenshot = (BitmapSource)BitmapDecoder.Create(this.ZipFile.GetInputStream(entry2), BitmapCreateOptions.None, BitmapCacheOption.None).Frames[0];
                    }
                    else if (strArray[0] == "Screenshots")
                    {
                        this.Screenshots.Add((BitmapSource)BitmapDecoder.Create(this.ZipFile.GetInputStream(entry2), BitmapCreateOptions.None, BitmapCacheOption.None).Frames[0]);
                    }
                    if (index != null)
                    {
                        this.themeItemEntries[index] = entry2;
                        this.ThemeItems.Add(index);
                    }
                }
                this.themeInfo.EndInit();
            }
        }
Esempio n. 28
0
 private static bool ThemeItemsEqual(IThemeItem item1, IThemeItem item2)
 {
     ImageResourceThemeItem resourceThemeItem1 = item1 as ImageResourceThemeItem;
     ImageResourceThemeItem resourceThemeItem2 = item2 as ImageResourceThemeItem;
     if (resourceThemeItem1 == null || resourceThemeItem2 == null)
         return item1 == item2;
     if (resourceThemeItem1.ResourceName == resourceThemeItem2.ResourceName && resourceThemeItem1.ResourceType == resourceThemeItem2.ResourceType)
         return resourceThemeItem1.DllName == resourceThemeItem2.DllName;
     else
         return false;
 }
Esempio n. 29
0
 private static string GetStyle(IThemeItem themeItem)
 {
     return(GetStyleConverter().ConvertToString(themeItem.Style));
 }
Esempio n. 30
0
 private void UpdateThemeItemDirty(IThemeItem item)
 {
     if (this.IsDirty || !item.IsDirty)
         return;
     this.IsDirty = true;
 }