protected OemQuickLink GetBestQuickLink() { List <IQuickLink> list = new List <IQuickLink>(); Dictionary <IQuickLink, OemCategory> dictionary = new Dictionary <IQuickLink, OemCategory>(); foreach (string index in this.categories) { OemCategory oemCategory = this.Manager.OemManager.Categories[index]; if (oemCategory != null) { IQuickLink newestQuickLink = PartnerQuickLink.GetNewestQuickLink((IList <IQuickLink>)oemCategory.QuickLinks); if (newestQuickLink != null) { list.Add(newestQuickLink); dictionary[newestQuickLink] = oemCategory; } } } if (list.Count > 0) { IQuickLink newestQuickLink = PartnerQuickLink.GetNewestQuickLink((IList <IQuickLink>)list); this.category = dictionary[newestQuickLink]; return((OemQuickLink)newestQuickLink); } else { this.category = this.Manager.OemManager.Categories[this.categories[0]]; return((OemQuickLink)null); } }
public OemCategoryStrip(StartMenuManager manager, string title, string[] categories) { this.title = title; this.categories = categories; this.quickLinks = (ObservableCollection<IQuickLink>)new OemCategoryStrip.SingleQuickLinkCollection(); this.quickLink = (PartnerQuickLink)new OemCategoryStrip.OemCategoryLink(manager, this.categories); this.quickLink.BeginInit(); this.quickLink.EndInit(); this.QuickLinks.Add((IQuickLink)this.quickLink); }
protected override void InsertItem(int index, IQuickLink item) { if (this.Count == 0) { if (!(item is PartnerQuickLink)) throw new ArgumentException(); this.singleLink = (PartnerQuickLink)item; base.InsertItem(index, item); } else { OemQuickLink oemQuickLink = item as OemQuickLink; if (oemQuickLink == null) { PartnerQuickLink partnerQuickLink = item as PartnerQuickLink; if (partnerQuickLink != null) oemQuickLink = partnerQuickLink.OemQuickLink; } if (oemQuickLink == null) return; this.singleLink.OemQuickLink = oemQuickLink; } }
private static IQuickLink GetNewestQuickLink(IList <IQuickLink> links) { return(PartnerQuickLink.GetNewestQuickLink(links, true) ?? PartnerQuickLink.GetNewestQuickLink(links, false)); }