Ejemplo n.º 1
0
 private void BuildStripInfo(bool isAllUsers, ICollection <OemMenuStrip> strips)
 {
     if (strips == null)
     {
         return;
     }
     using (RegistryKey registryKey = OemManager.GetRegistryKey(isAllUsers).OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Media Center\\Start Menu\\Applications"))
     {
         if (registryKey == null)
         {
             return;
         }
         foreach (string name in registryKey.GetSubKeyNames())
         {
             using (RegistryKey key = registryKey.OpenSubKey(name))
             {
                 OemMenuStrip oemMenuStrip = (OemMenuStrip)this.managerRs.Deserialise(this.MenuStripType, key);
                 OemMenuStrip oemStrip     = this.GetOemStrip(oemMenuStrip.Application, (IEnumerable <OemMenuStrip>)strips);
                 if (oemStrip != null)
                 {
                     this.managerRs.Deserialise((object)oemStrip, key);
                 }
                 else if (oemMenuStrip.Application != null)
                 {
                     if (!string.IsNullOrEmpty(oemMenuStrip.Category))
                     {
                         strips.Add(oemMenuStrip);
                     }
                 }
             }
         }
     }
 }
Ejemplo n.º 2
0
        private static void CategoryChanged(DependencyObject sender, DependencyPropertyChangedEventArgs args)
        {
            OemMenuStrip oemMenuStrip = (OemMenuStrip)sender;

            if (oemMenuStrip.stripCategory != null)
            {
                oemMenuStrip.stripCategory.QuickLinks.CollectionChanged -= new NotifyCollectionChangedEventHandler(oemMenuStrip.QuickLinks_CollectionChanged);
            }
            oemMenuStrip.stripCategory = oemMenuStrip.Manager.Categories[(string)args.NewValue];
            oemMenuStrip.stripCategory.QuickLinks.CollectionChanged += new NotifyCollectionChangedEventHandler(oemMenuStrip.QuickLinks_CollectionChanged);
        }
Ejemplo n.º 3
0
 protected override XmlNode CreateOemStripNode(OemMenuStrip strip, int index)
 {
     string attribute = this.StartMenuDocument.DocumentElement.GetAttribute("xmlns:home");
     XmlElement element1 = this.StartMenuDocument.CreateElement("home", "ConstrainedCategory", attribute);
     XmlElement element2 = this.StartMenuDocument.CreateElement("Value", "http://schemas.microsoft.com/2006/mcml");
     element1.AppendChild((XmlNode)element2);
     XmlElement element3 = this.StartMenuDocument.CreateElement("home", "ExtensibilityPlaceholderStartMenuCategory", attribute);
     element2.AppendChild((XmlNode)element3);
     element3.SetAttribute("Index", index.ToString());
     element3.SetAttribute("Priority", strip == null ? "100" : strip.Priority.ToString());
     return (XmlNode)element1;
 }
Ejemplo n.º 4
0
 protected override IMenuStrip CreateCustomStrip()
 {
     OemManager oemManager = this.OemManager;
     Application application = new Application();
     application.Title = "Custom menu";
     application.ID = "{" + (object)Guid.NewGuid() + "}";
     oemManager.Applications.Add(application);
     OemMenuStrip oemMenuStrip = new OemMenuStrip();
     oemMenuStrip.Manager = oemManager;
     oemMenuStrip.Application = application;
     oemMenuStrip.Title = application.Title;
     oemMenuStrip.Priority = 100;
     oemMenuStrip.IsEnabled = true;
     string str = this.CustomCategory + "\\Strip " + application.ID;
     oemMenuStrip.Category = str;
     return (IMenuStrip)oemMenuStrip;
 }
Ejemplo n.º 5
0
 protected override XmlNode CreateOemStripNode(OemMenuStrip strip, int index)
 {
     XmlElement element = this.StartMenuDocument.CreateElement("home", "OEMPlaceholder", this.StartMenuDocument.DocumentElement.GetAttribute("xmlns:home"));
     element.SetAttribute("Index", index.ToString());
     element.SetAttribute("MaxQuickLinks", strip == null ? "100" : strip.QuickLinks.Count.ToString());
     element.SetAttribute("Priority", strip == null ? "100" : strip.Priority.ToString());
     return (XmlNode)element;
 }