protected override XmlNode CreateOemStripNode(OemMenuStrip strip, int index) { XmlElement element = this.StartMenuDocument.CreateElement("home", "OEMPlaceholder", this.StartMenuDocument.DocumentElement.GetAttribute("xmlns:home")); element.SetAttribute("Index", index.ToString()); element.SetAttribute("MaxQuickLinks", strip == null ? "100" : strip.QuickLinks.Count.ToString()); element.SetAttribute("Priority", strip == null ? "100" : strip.Priority.ToString()); return((XmlNode)element); }
protected override XmlNode CreateOemStripNode(OemMenuStrip strip, int index) { string attribute = this.StartMenuDocument.DocumentElement.GetAttribute("xmlns:home"); XmlElement element1 = this.StartMenuDocument.CreateElement("home", "ConstrainedCategory", attribute); XmlElement element2 = this.StartMenuDocument.CreateElement("Value", "http://schemas.microsoft.com/2006/mcml"); element1.AppendChild((XmlNode)element2); XmlElement element3 = this.StartMenuDocument.CreateElement("home", "ExtensibilityPlaceholderStartMenuCategory", attribute); element2.AppendChild((XmlNode)element3); element3.SetAttribute("Index", index.ToString()); element3.SetAttribute("Priority", strip == null ? "100" : strip.Priority.ToString()); return((XmlNode)element1); }
protected override void OnCollectionChanged(NotifyCollectionChangedEventArgs e) { this.manager.IsDirty = true; List <IMenuStrip> list = new List <IMenuStrip>(); if (e.OldItems != null) { foreach (IMenuStrip menuStrip in (IEnumerable)e.OldItems) { OemMenuStrip oemMenuStrip1 = menuStrip as OemMenuStrip; if (oemMenuStrip1 != null) { this.manager.OemManager.StartMenuStrips.Remove(oemMenuStrip1); for (int index = 0; index < this.manager.OemManager.StartMenuStrips.Count; ++index) { OemMenuStrip oemMenuStrip2 = this.manager.OemManager.StartMenuStrips[index]; if (oemMenuStrip2 != null && oemMenuStrip2.IsEnabled && (!this.Contains((IMenuStrip)oemMenuStrip2) && !e.OldItems.Contains((object)oemMenuStrip2))) { oemMenuStrip2.Priority = oemMenuStrip1.Priority; list.Add((IMenuStrip)oemMenuStrip2); break; } } } if (e.NewItems == null || !e.NewItems.Contains((object)menuStrip)) { menuStrip.QuickLinks.Clear(); } } } if (e.NewItems != null) { foreach (IMenuStrip menuStrip in (IEnumerable)e.NewItems) { OemMenuStrip oemMenuStrip = menuStrip as OemMenuStrip; if (oemMenuStrip != null && !this.manager.OemManager.StartMenuStrips.Contains(oemMenuStrip)) { this.manager.OemManager.StartMenuStrips.Add(oemMenuStrip); } } } base.OnCollectionChanged(e); foreach (IMenuStrip menuStrip in list) { this.Insert(e.OldStartingIndex, menuStrip); } }
protected override IMenuStrip CreateCustomStrip() { OemManager oemManager = this.OemManager; Application application = new Application(); application.Title = "Custom menu"; application.ID = "{" + (object)Guid.NewGuid() + "}"; oemManager.Applications.Add(application); OemMenuStrip oemMenuStrip = new OemMenuStrip(); oemMenuStrip.Manager = oemManager; oemMenuStrip.Application = application; oemMenuStrip.Title = application.Title; oemMenuStrip.Priority = 100; oemMenuStrip.IsEnabled = true; string str = this.CustomCategory + "\\Strip " + application.ID; oemMenuStrip.Category = str; return((IMenuStrip)oemMenuStrip); }
protected abstract XmlNode CreateOemStripNode(OemMenuStrip strip, int index);
public virtual void Save(IResourceLibraryCache cache, bool forceSave) { try { if (!this.IsDirty && !forceSave) { return; } this.OnSaving(EventArgs.Empty); IResourceLibrary resourceLibrary = cache["ehres.dll"]; this.SaveInternal(resourceLibrary); List <XmlNode> list = new List <XmlNode>(); foreach (XmlElement element in this.StripParentNode.ChildNodes) { int index; if (this.IsOemPlaceholderElement(element, out index)) { list.Add((XmlNode)element); } } foreach (XmlNode oldChild in list) { this.StripParentNode.RemoveChild(oldChild); } int index1 = 0; foreach (IMenuStrip menuStrip in (Collection <IMenuStrip>) this.managerStrips) { BaseXmlMenuStrip strip1 = menuStrip as BaseXmlMenuStrip; if (strip1 != null) { if (strip1.StartMenuElement.ParentNode != null) { strip1.StartMenuElement.ParentNode.RemoveChild((XmlNode)strip1.StartMenuElement); } this.StripParentNode.AppendChild(this.GetNodeForSave(strip1)); strip1.Save(resourceLibrary); } else { OemMenuStrip strip2 = menuStrip as OemMenuStrip; if (strip2 != null) { strip2.TimeStamp = int.MaxValue - index1; this.StripParentNode.AppendChild(this.CreateOemStripNode(strip2, index1)); ++index1; } } } int customStripCount; for (customStripCount = this.MinCustomStripCount; index1 < customStripCount; ++index1) { this.StripParentNode.AppendChild(this.CreateOemStripNode((OemMenuStrip)null, index1)); } this.UpdateOemStripCount(customStripCount); if (this.oemManager != null) { this.oemManager.Save(); } MediaCenterUtil.SaveXmlResource(resourceLibrary, "STARTMENU.XML", 23, this.StartMenuDocument); this.IsDirty = false; } finally { this.OnSaved(EventArgs.Empty); } }