Beispiel #1
0
        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();
                    }
                }
            }
        }
Beispiel #2
0
        protected override void Load()
        {
            string attribute = this.LinkElement.GetAttribute("Description");

            this.Title           = MediaCenterUtil.GetStringResource(this.Manager.Resources, attribute, false) ?? attribute;
            this.m_originalTitle = this.Title;
            XmlNode firstChild = this.LinkElement.FirstChild;

            if (firstChild == null || !(firstChild.Name == "Image") || firstChild.FirstChild == null)
            {
                return;
            }
            ImageSet imageSet = ImageSet.FromXml(this.Manager.Resources, firstChild.FirstChild as XmlElement);

            this.SetValue(XmlQuickLink.ImageProperty, (object)imageSet["Focus"]);
            this.SetValue(XmlQuickLink.NonFocusImageProperty, (object)imageSet["Default"]);
        }
Beispiel #3
0
        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();
                    }
                }
            }
        }