Exemplo n.º 1
0
        private List <项列表的状态> Search(string path, string[] reg_key)
        {
            //参数1为搜索的注册表路径.
            //参数2为特征键集合,一般关联菜单都有这些键.
            List <RegistryKey> reg   = RegEdit.Context_meun(RegEdit.Reg_edit(path, false), reg_key);
            项列表的状态             tmp   = new  项列表的状态();
            List <项列表的状态>      Field = new List <项列表的状态>();

            for (int i = 0; i < reg.Count; i++)
            {
                if (reg[i].GetValue("MUIVerb") != null)
                {
                    tmp.title = reg[i].GetValue("MUIVerb").ToString();
                }
                else if (reg[i].GetValue("") != null)
                {
                    tmp.title = reg[i].GetValue("").ToString();
                }
                else
                {
                    tmp.title = reg[i].Name.Split(new char[] { '\\' }, StringSplitOptions.RemoveEmptyEntries).Last();
                }
                tmp.state       = true;//刷新时永远为真
                tmp.OpenOrClose = new EventHandler(this.Process);
                tmp.RegKey      = reg[i];
                Field.Add(tmp);
            }
            return(Field);
        }
Exemplo n.º 2
0
        private void Process(object sender, EventArgs e)//点击启用或者禁用的处理函数
        {
            项列表 tmp = ( 项列表)sender;

            if (tmp.State)
            {
                if (RegEdit.MyDeleteSubKeyTree(tmp.RegKey))   //删除此tmp的注册表路径
                {
                    tmp.State = !tmp.State;
                }
                else
                {
                    MessageBox.Show("删除失败!", "Warning:", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }