protected override void InsertItem(int index, IQuickLink item) { IQuickLink quickLink = item; IPartnerQuickLink partnerQuickLink = item as IPartnerQuickLink; if (partnerQuickLink != null) { quickLink = (IQuickLink)partnerQuickLink.OemQuickLink; } base.InsertItem(index, quickLink); }
public virtual IPartnerQuickLink GetFreePartnerQuickLink() { foreach (IQuickLink quickLink in (Collection <IQuickLink>) this) { IPartnerQuickLink partnerQuickLink = quickLink as IPartnerQuickLink; if (partnerQuickLink != null && partnerQuickLink.OemQuickLink == null) { return(partnerQuickLink); } } return((IPartnerQuickLink)null); }
protected override void RemoveItem(int index) { IPartnerQuickLink partnerQuickLink = this[index] as IPartnerQuickLink; if (partnerQuickLink != null) { partnerQuickLink.OemQuickLink = (OemQuickLink)null; } else { base.RemoveItem(index); } }
protected override void InsertItem(int index, IQuickLink item) { if (!this.inInit) { IPartnerQuickLink partnerQuickLink1 = item as IPartnerQuickLink; OemQuickLink oemQuickLink = partnerQuickLink1 == null ? item as OemQuickLink : partnerQuickLink1.OemQuickLink; if (oemQuickLink != null) { IPartnerQuickLink partnerQuickLink2 = this.GetFreePartnerQuickLink(); if (partnerQuickLink2 != null) { partnerQuickLink2.OemQuickLink = oemQuickLink; int oldIndex = this.IndexOf((IQuickLink)partnerQuickLink2); this.Move(oldIndex, oldIndex < index ? index - 1 : index); } } else { base.InsertItem(index, item); } XmlQuickLink xmlQuickLink = item as XmlQuickLink; if (xmlQuickLink == null || xmlQuickLink.XmlElement.OwnerDocument == this.strip.xml || xmlQuickLink is IPartnerQuickLink) { return; } if (xmlQuickLink.XmlElement.ParentNode != null) { XmlElement documentElement = this.strip.MenuStripDocument.DocumentElement; foreach (XmlAttribute xmlAttribute in (XmlNamedNodeMap)xmlQuickLink.XmlElement.OwnerDocument.DocumentElement.Attributes) { XmlAttribute attributeNode = documentElement.GetAttributeNode(xmlAttribute.Name); if (xmlAttribute.Name.StartsWith("xmlns:") && attributeNode == null) { documentElement.SetAttribute(xmlAttribute.Name, xmlAttribute.Value); } } xmlQuickLink.XmlElement.ParentNode.RemoveChild((XmlNode)xmlQuickLink.XmlElement); } xmlQuickLink.XmlElement = (XmlElement)this.strip.xml.ImportNode((XmlNode)xmlQuickLink.XmlElement, true); } else { base.InsertItem(index, item); } }
public List <OemQuickLink> GetPartnerQuickLinks() { List <OemQuickLink> list = new List <OemQuickLink>(); foreach (IQuickLink quickLink in (Collection <IQuickLink>) this) { IPartnerQuickLink partnerQuickLink = quickLink as IPartnerQuickLink; if (partnerQuickLink != null && partnerQuickLink.OemQuickLink != null) { OemQuickLink oemQuickLink = partnerQuickLink.OemQuickLink; if (oemQuickLink != null) { list.Add(oemQuickLink); } } } return(list); }
protected override IPartnerQuickLink GetFreePartnerQuickLink(OemQuickLink oemLink) { IPartnerQuickLink partnerQuickLink = base.GetFreePartnerQuickLink(oemLink); if (partnerQuickLink == null) { XmlElement element = this.MenuStripDocument.CreateElement("home", "DefaultPartnerQuicklink", this.MenuStripDocument.DocumentElement.GetAttribute("xmlns:home")); element.SetAttribute("ExtensibilityCategory", string.Format("{0}\\Category {{{1}}}", (object)this.Manager.CustomInternalCategory, (object)Guid.NewGuid())); int num = 100; element.SetAttribute("Priority", num.ToString()); partnerQuickLink = (IPartnerQuickLink) new FijiPartnerQuickLink(this.Manager, element, true); partnerQuickLink.BeginInit(); partnerQuickLink.Priority = num; XmlMenuStrip.XmlQuickLinkCollection quickLinkCollection = (XmlMenuStrip.XmlQuickLinkCollection) this.QuickLinks; quickLinkCollection.BeginInit(); quickLinkCollection.Add((IQuickLink)partnerQuickLink); quickLinkCollection.EndInit(); partnerQuickLink.EndInit(); } return(partnerQuickLink); }
protected override IPartnerQuickLink GetFreePartnerQuickLink(OemQuickLink oemLink) { IPartnerQuickLink partnerQuickLink = base.GetFreePartnerQuickLink(oemLink); if (partnerQuickLink == null) { string attribute1 = this.MenuStripDocument.DocumentElement.GetAttribute("xmlns"); string attribute2 = this.MenuStripDocument.DocumentElement.GetAttribute("xmlns:home"); XmlElement element1 = this.MenuStripDocument.CreateElement("home", "CommandQuickLink", attribute2); element1.SetAttribute("SqmTrackingId", "-1"); element1.SetAttribute("ViewTemplate", "@res://Microsoft.MediaCenter.Shell!StartMenuQuickLink.mcml#PartnerQuickLinkContent"); XmlElement element2 = this.MenuStripDocument.CreateElement("Image", attribute1); element1.AppendChild((XmlNode)element2); XmlElement element3 = this.MenuStripDocument.CreateElement("shll", "ImageSet", this.MenuStripDocument.DocumentElement.GetAttribute("xmlns:shll")); element3.SetAttribute("DefaultImageName", "Default"); element2.AppendChild((XmlNode)element3); XmlElement element4 = this.MenuStripDocument.CreateElement("Values", attribute1); element3.AppendChild((XmlNode)element4); XmlElement element5 = this.MenuStripDocument.CreateElement("Image", attribute1); element5.SetAttribute("Name", "Default"); element4.AppendChild((XmlNode)element5); XmlElement element6 = this.MenuStripDocument.CreateElement("Image", attribute1); element6.SetAttribute("Name", "Focus"); element4.AppendChild((XmlNode)element6); XmlElement element7 = this.MenuStripDocument.CreateElement("Command", attribute1); element1.AppendChild((XmlNode)element7); XmlElement element8 = this.MenuStripDocument.CreateElement("home", "LaunchExtensibilityEntryPointCommand", attribute2); element7.AppendChild((XmlNode)element8); partnerQuickLink = (IPartnerQuickLink) new Windows7PartnerQuickLink(this.Manager, element1); partnerQuickLink.BeginInit(); partnerQuickLink.Priority = int.MaxValue; XmlMenuStrip.XmlQuickLinkCollection quickLinkCollection = (XmlMenuStrip.XmlQuickLinkCollection) this.QuickLinks; quickLinkCollection.BeginInit(); quickLinkCollection.Add((IQuickLink)partnerQuickLink); quickLinkCollection.EndInit(); partnerQuickLink.EndInit(); } return(partnerQuickLink); }
public bool CanAddQuickLink(IQuickLink link) { OemQuickLink link1 = link as OemQuickLink; if (link1 == null) { IPartnerQuickLink partnerQuickLink = link as IPartnerQuickLink; if (partnerQuickLink != null) { link1 = partnerQuickLink.OemQuickLink; } } if (link1 != null) { if (!this.quickLinks.GetPartnerQuickLinks().Contains(link1)) { return(this.GetFreePartnerQuickLink(link1) != null); } else { return(true); } } else { if (!(link is XmlQuickLink)) { return(false); } if (link.OriginalStrip != null && link.OriginalStrip != this) { return(this.Manager.Strips.IndexOf((IMenuStrip)this) > this.Manager.Strips.IndexOf(link.OriginalStrip)); } else { return(true); } } }