protected override void Load() { XmlAttribute xmlAttribute1 = this.StartMenuCategoryNode.Attributes["App"]; this.app = xmlAttribute1 == null ? (string)null : xmlAttribute1.Value; XmlAttribute xmlAttribute2 = this.StartMenuCategoryNode.Attributes["AppId"]; this.appId = xmlAttribute2 == null ? (string)null : xmlAttribute2.Value; string uri = this.StartMenuCategoryNode.Attributes["Description"].Value; this.Title = MediaCenterUtil.GetStringResource(this.Manager.Resources, uri, false) ?? uri; this.originalTitle = this.Title; this.IsEnabled = true; XmlNodeList childNodes = this.QuickLinksNode.ChildNodes; for (int index = 0; index < childNodes.Count; ++index) { bool flag = true; XmlElement element = childNodes[index] as XmlElement; if (element == null) { XmlComment comment = childNodes[index] as XmlComment; if (comment != null) { element = MediaCenterUtil.UncommentElement(comment); flag = element == null; } } if (element != null) { IQuickLink quickLink = (IQuickLink)null; try { quickLink = element.Name == "home:PackageMarkupQuickLink" || element.Name == "home:ExtensiblityPackageQuickLink" || element.Name == "home:DualPackageMarkupQuickLink" ? (IQuickLink) new PackageQuickLink(this.Manager, element) : (!(element.Name == "home:DefaultPartnerQuicklink") ? (IQuickLink) new FijiQuickLink(this.Manager, element) : (IQuickLink) new FijiPartnerQuickLink(this.Manager, element)); } catch (Exception ex) { Trace.TraceWarning("Failed to load link. Exception is:\n{0}\nXml for element is:\n{1}", (object)((object)ex).ToString(), (object)element.OuterXml); } if (quickLink != null) { quickLink.BeginInit(); int result; if (int.TryParse(element.GetAttribute("Priority"), out result)) { quickLink.Priority = result; quickLink.IsEnabled = flag; this.QuickLinks.Add(quickLink); } quickLink.EndInit(); } } } }
protected override IMenuStrip CreateMenuStrip(XmlNode node, IResourceLibrary ehres) { XmlElement startMenuTargetElement = node as XmlElement; bool flag = true; if (startMenuTargetElement == null) { XmlComment comment = node as XmlComment; if (comment != null) { startMenuTargetElement = MediaCenterUtil.UncommentElement(comment); flag = startMenuTargetElement == null; } } IMenuStrip menuStrip = (IMenuStrip)null; if (startMenuTargetElement != null) { XmlElement xmlElement = startMenuTargetElement; if (startMenuTargetElement.Name == "home:ConstrainedCategory" || startMenuTargetElement.Name == "constraints:ConstrainedItem") { startMenuTargetElement = (XmlElement)startMenuTargetElement.FirstChild.FirstChild; } if (startMenuTargetElement.Name == "home:NowPlayingStartMenuCategory") { menuStrip = (IMenuStrip) new NowPlayingStrip((StartMenuManager)this, xmlElement); } else if (!(startMenuTargetElement.Name == "home:MSOStartMenuCategory")) { string attribute1 = startMenuTargetElement.GetAttribute("StartMenuCategory"); if (!string.IsNullOrEmpty(attribute1) && attribute1.StartsWith("global://")) { int num = attribute1.IndexOf(':', "global://".Length); if (num >= 0) { string str = attribute1.Substring("global://".Length, num - "global://".Length); string attribute2 = this.StartMenuDocument.DocumentElement.GetAttribute("xmlns:" + str); if (!string.IsNullOrEmpty(attribute2)) { string resourceName; XmlReader xmlResource = MediaCenterUtil.GetXmlResource(this.Resources, attribute2, out resourceName); if (xmlResource != null) { XmlDocument doc = new XmlDocument(); doc.Load(xmlResource); Windows7MenuStrip windows7MenuStrip = new Windows7MenuStrip((StartMenuManager)this, doc, xmlElement, startMenuTargetElement, resourceName); windows7MenuStrip.StartMenuNamespace = str; windows7MenuStrip.IsEnabled = flag; menuStrip = (IMenuStrip)windows7MenuStrip; } else { Trace.TraceWarning("Strip {0} points to null resource: {1}", (object)startMenuTargetElement.Name, (object)attribute2); } } else { Trace.TraceWarning("Could not find namespace \"{0}\". Element: {1}", (object)str, (object)startMenuTargetElement.OuterXml); } } else { Trace.TraceWarning("Invalid StartMenuCategory value \"{0}\". Element: {1}", (object)attribute1, (object)startMenuTargetElement.OuterXml); } } else { Trace.TraceWarning("Unknown application element: {0}", new object[1] { (object)startMenuTargetElement.OuterXml }); } } } int result; if (menuStrip != null && int.TryParse(startMenuTargetElement.GetAttribute("Priority"), out result)) { menuStrip.Priority = result; } return(menuStrip); }
protected override void Load() { XmlAttribute xmlAttribute1 = this.StartMenuCategoryNode.Attributes["App"]; this.m_app = xmlAttribute1 == null ? (string)null : xmlAttribute1.Value; XmlAttribute xmlAttribute2 = this.StartMenuCategoryNode.Attributes["AppId"]; this.m_appId = xmlAttribute2 == null ? (string)null : xmlAttribute2.Value; string uri = this.StartMenuCategoryNode.Attributes["Description"].Value; this.Title = MediaCenterUtil.GetStringResource(this.Manager.Resources, uri, false) ?? uri; this.m_originalTitle = this.Title; this.IsEnabled = true; XmlNodeList childNodes = this.QuickLinksNode.ChildNodes; for (int index = 0; index < childNodes.Count; ++index) { bool flag = true; XmlElement xmlElement1 = childNodes[index] as XmlElement; if (xmlElement1 == null) { XmlComment comment = childNodes[index] as XmlComment; if (comment != null) { xmlElement1 = MediaCenterUtil.UncommentElement(comment); flag = xmlElement1 == null; } } if (xmlElement1 != null) { XmlElement linkElement = Windows7QuickLinkBase.GetLinkElement(xmlElement1); IQuickLink quickLink = (IQuickLink)null; try { if (linkElement.Name == "home:PackageMarkupQuickLink" || linkElement.Name == "home:ExtensiblityPackageQuickLink" || linkElement.Name == "home:DualPackageMarkupQuickLink") { quickLink = (IQuickLink) new Windows7PackageQuickLink(this.Manager, xmlElement1); } else if (linkElement.Name == "home:BroadbandPromoQuicklink") { quickLink = (IQuickLink) new BroadbandPromoQuickLink(this.Manager, xmlElement1); } else if (linkElement.Name == "home:FavoritePartnerQuicklink") { quickLink = (IQuickLink) new FavouritePartnerQuickLink(this.Manager, xmlElement1); } else { XmlElement xmlElement2 = Enumerable.FirstOrDefault <XmlElement>(Enumerable.OfType <XmlElement>((IEnumerable)linkElement.ChildNodes), (Func <XmlElement, bool>)(o => o.Name == "Command")); quickLink = xmlElement2 == null || !(xmlElement2.FirstChild.Name == "home:LaunchExtensibilityEntryPointCommand") ? (IQuickLink) new Windows7QuickLink(this.Manager, xmlElement1) : (IQuickLink) new Windows7PartnerQuickLink(this.Manager, xmlElement1); } } catch (Exception ex) { Trace.TraceWarning("Failed to load link. Exception is:\n{0}\nXml for element is:\n{1}", (object)((object)ex).ToString(), (object)xmlElement1.OuterXml); } if (quickLink != null) { quickLink.BeginInit(); XmlQuickLink xmlQuickLink = quickLink as XmlQuickLink; if (xmlQuickLink != null) { int result = int.MaxValue; int.TryParse(xmlQuickLink.LinkElement.GetAttribute("Priority"), out result); xmlQuickLink.Priority = result; } quickLink.IsEnabled = flag; this.QuickLinks.Add(quickLink); quickLink.EndInit(); } } } }