Beispiel #1
0
            protected override void RemoveItem(int index)
            {
                EntryPoint entryPoint = base[index];

                base.RemoveItem(index);
                foreach (OemCategory oemCategory in (Collection <OemCategory>) this.Manager.Categories)
                {
                    for (int index1 = 0; index1 < oemCategory.QuickLinks.Count; ++index1)
                    {
                        OemQuickLink oemQuickLink = oemCategory.QuickLinks[index1] as OemQuickLink;
                        if (oemQuickLink != null && oemQuickLink.EntryPoint == entryPoint)
                        {
                            oemCategory.QuickLinks.RemoveAt(index1);
                            break;
                        }
                    }
                }
                Application application = entryPoint.Application;

                if (application == null)
                {
                    return;
                }
                application.EntryPoints.Remove(entryPoint);
                if (application.EntryPoints.Count != 0)
                {
                    return;
                }
                this.Manager.Applications.Remove(application);
            }
Beispiel #2
0
 private OemQuickLink GetQuickLink(OemQuickLink l)
 {
     foreach (OemQuickLink oemQuickLink in (Collection <IQuickLink>) this.QuickLinks)
     {
         if (oemQuickLink.EntryPointID.ToUpper() == l.EntryPointID.ToUpper())
         {
             return(oemQuickLink);
         }
     }
     return((OemQuickLink)null);
 }
Beispiel #3
0
            protected override void OnCollectionChanged(NotifyCollectionChangedEventArgs e)
            {
                bool flag = false;
                int  num  = -1;

                foreach (OemQuickLink oemQuickLink in (Collection <IQuickLink>) this)
                {
                    if (oemQuickLink.Priority > num)
                    {
                        num = oemQuickLink.Priority;
                    }
                    else
                    {
                        flag = true;
                    }
                }
                if (flag)
                {
                    for (int index = 0; index < this.Count; ++index)
                    {
                        OemQuickLink oemQuickLink = (OemQuickLink)this[index];
                        if (this.oemCategory.IsInInit)
                        {
                            oemQuickLink.BeginInit();
                        }
                        oemQuickLink.Priority = index;
                        if (this.oemCategory.IsInInit)
                        {
                            oemQuickLink.EndInit();
                        }
                    }
                }
                if (e.OldItems != null)
                {
                    foreach (OemQuickLink oemQuickLink in (IEnumerable)e.OldItems)
                    {
                        this.oemCategory.deletedLinks.Add(oemQuickLink.EntryPointID.ToUpper());
                    }
                }
                if (e.NewItems != null)
                {
                    foreach (OemQuickLink oemQuickLink in (IEnumerable)e.NewItems)
                    {
                        this.oemCategory.deletedLinks.Remove(oemQuickLink.EntryPointID.ToUpper());
                        oemQuickLink.EntryPoint.EnsureValidForMenu();
                    }
                }
                base.OnCollectionChanged(e);
            }
Beispiel #4
0
        protected override void OnAfterDeserialise(RegistrySerialiser rs, RegistryKey key)
        {
            List <IQuickLink> list = new List <IQuickLink>();

            foreach (string str in key.GetSubKeyNames())
            {
                if (MediaCenterUtil.IsGuid(str))
                {
                    using (RegistryKey key1 = key.OpenSubKey(str))
                    {
                        OemQuickLink l         = (OemQuickLink)rs.Deserialise(this.Manager.QuickLinkType, key1);
                        OemQuickLink quickLink = this.GetQuickLink(l);
                        if (quickLink != null)
                        {
                            rs.Deserialise((object)quickLink, key1);
                            list.Add((IQuickLink)quickLink);
                        }
                        else if (l.EntryPoint != null)
                        {
                            if (l.Application != null)
                            {
                                list.Add((IQuickLink)l);
                            }
                        }
                    }
                }
            }
            foreach (IQuickLink quickLink in list)
            {
                if (!this.categoryQuickLinks.Contains(quickLink))
                {
                    int index = 0;
                    while (index < this.categoryQuickLinks.Count && quickLink.Priority >= this.categoryQuickLinks[index].Priority)
                    {
                        ++index;
                    }
                    this.categoryQuickLinks.Insert(index, quickLink);
                }
            }
            this.categoryName = key.Name.Substring(key.Name.LastIndexOf("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Media Center\\Extensibility\\Categories") + "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Media Center\\Extensibility\\Categories".Length + 1);
            base.OnAfterDeserialise(rs, key);
        }