示例#1
0
        public override void Add()
        {
            String truc = base.GetRegisteryPathForAdd();

            {
                EcuriesDuLoupWin.utils.Registry reg = this.Create(truc, "MUIVerb", this.Label);
                reg.Add();
            }
            {
                EcuriesDuLoupWin.utils.Registry reg = this.Create(truc, "SubCommands", "");
                reg.Add();
            }
            {
                if (this.Icon != null)
                {
                    EcuriesDuLoupWin.utils.Registry reg = this.Create(truc, "Icon", this.Icon);
                    reg.Add();
                }
            }
            {
                EcuriesDuLoupWin.utils.Registry reg = this.Create(this.GetRegisteryPathForAdd());
                reg.Add();
            }
            foreach (ContextMenu contextMenu in this.Menu)
            {
                contextMenu.Parent = this;
                contextMenu.Add();
            }

            /*    this.Command
             *  RegistryKey rkcu = Microsoft.Win32.Registry.ClassesRoot;
             *
             *  RegistryKey test = rkcu.CreateSubKey(base.GetRegisteryPathForAdd());
             *  test.SetValue("MUIVerb", this.Label);
             *  test.SetValue("SubCommands", "");
             *  if (this.Icon != null)
             *  {
             *      test.SetValue("Icon", this.Icon);
             *  }
             *  rkcu.CreateSubKey(this.GetRegisteryPathForAdd());
             *  foreach (ContextMenu contextMenu in this.Menu)
             *  {
             *      contextMenu.Parent = this;
             *      contextMenu.Add();
             *  }*/
        }
示例#2
0
        public virtual void Remove()
        {
            try
            {
                /*RegistryKey rkcu = Microsoft.Win32.Registry.ClassesRoot;
                 * if (rkcu.OpenSubKey(this.GetRegisteryPathForRemove()) != null)
                 * {
                 *  rkcu.DeleteSubKeyTree(this.GetRegisteryPathForRemove());
                 *  rkcu.Close();
                 * }*/

                EcuriesDuLoupWin.utils.Registry reg = this.Create(this.GetRegisteryPathForRemove());
                reg.Remove();
            }
            catch (Exception e)
            {
                Console.WriteLine("Remove : " + e.Message);
            }
        }
示例#3
0
        public virtual void Add()
        {
            try
            {
                /*RegistryKey rkcu = Microsoft.Win32.Registry.ClassesRoot;
                 * //create name
                 * RegistryKey test1 = rkcu.CreateSubKey(this.GetRegisteryPathForAdd());
                 * test1.SetValue("MUIVerb", this.Label);
                 * if (this.Icon != null)
                 * {
                 *  test1.SetValue("Icon", this.Icon);
                 * }
                 * test1.Close();*/


                //create command

                /*RegistryKey test = rkcu.CreateSubKey(this.GetRegisteryPathForAdd() + "\\command");
                 * test.SetValue("", this.Command);
                 * test.Close();*/


                String truc = this.GetRegisteryPathForAdd();
                EcuriesDuLoupWin.utils.Registry reg = this.Create(truc, "MUIVerb", this.Label);
                reg.Add();
                if (this.Icon != null)
                {
                    EcuriesDuLoupWin.utils.Registry regIcon = this.Create(truc, "Icon", this.Icon);
                    regIcon.Add();
                }


                EcuriesDuLoupWin.utils.Registry regCommand = this.Create(truc + "\\command", "", this.Command);
                regCommand.Add();
            }
            catch (Exception e)
            {
                Console.WriteLine("ContextMenu.Add : " + e.Message);
            }
        }