Ejemplo n.º 1
0
        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);
            }
        }
Ejemplo n.º 2
0
 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;
     }
 }
Ejemplo n.º 3
0
 protected override void Load()
 {
     base.Load();
     this.categories = this.Categories;
     if (this.categories != null)
     {
         foreach (string index in this.categories)
         {
             OemCategory oemCategory = this.Manager.OemManager.Categories[index];
             if (oemCategory != null)
             {
                 oemCategory.QuickLinks.CollectionChanged += new NotifyCollectionChangedEventHandler(this.QuickLinks_CollectionChanged);
             }
         }
     }
     this.OemQuickLink = this.GetBestQuickLink();
 }
Ejemplo n.º 4
0
        private void NewApplicationExecuted(object sender, ExecutedRoutedEventArgs e)
        {
            OemManager oemManager = this.m_startMenu.StartMenuManager.OemManager;

            Advent.MediaCenter.StartMenu.OEM.EntryPoint ep = new Advent.MediaCenter.StartMenu.OEM.EntryPoint();
            ep.Manager     = oemManager;
            ep.ID          = "{" + Guid.NewGuid() + "}";
            ep.Title       = "New Entry Point";
            ep.RawImageUrl = string.Empty;
            ep.AddIn       = typeof(VmcExecuteAddIn).AssemblyQualifiedName;
            bool        isSaved  = false;
            OemCategory category = oemManager.Categories["More Programs"];

            ep.Saving += delegate
            {
                if (!isSaved)
                {
                    Advent.MediaCenter.StartMenu.OEM.Application application = new Advent.MediaCenter.StartMenu.OEM.Application();
                    application.ID    = "{" + Guid.NewGuid() + "}";
                    application.Title = ep.Title;
                    oemManager.Applications.Add(application);
                    ep.Application = application;
                    oemManager.EntryPoints.Add(ep);
                    OemQuickLink oemQuickLink = new OemQuickLink(oemManager);
                    oemQuickLink.BeginInit();
                    oemQuickLink.Application = application;
                    oemQuickLink.EntryPoint  = ep;
                    oemQuickLink.EndInit();
                    category.QuickLinks.Add(oemQuickLink);
                }
            };
            ep.Saved += delegate
            {
                if (!isSaved)
                {
                    category.Save();
                }
                isSaved = true;
            };
            EntryPointDocumentView.OpenDocument(ep);
            e.Handled = true;
        }