private void delete_Click(object sender, System.EventArgs e)
        {
            int index = varlist.SelectedIndex;

            if (index > -1)
            {
                GlobalVarient gv = _vhash[varlist.SelectedItem] as GlobalVarient;
                gv.NameChanged -= new EventHandler(gv_NameChanged);
                _varients.Remove(gv);
                varlist.Items.Remove(gv.Name);
                _vhash.Remove(gv.Name);
                if (varlist.Items.Count > index)
                {
                    prop.SelectedObject = _vhash[varlist.SelectedItem];
                }
                else
                {
                    varlist.SelectedIndex = varlist.Items.Count - 1;
                }
            }
            if (varlist.Items.Count == 0)
            {
                prop.SelectedObject = null;
            }
        }
 public void Add(GlobalVarient value)
 {
     if (value.Name.Trim() == "")
     {
         CalcName(value);
     }
     UnRegisterVarientEvent(value);
     RegisterVarientEvent(value);
     this.InnerList.Add(value);
 }
        private void add_Click(object sender, System.EventArgs e)
        {
            GlobalVarient gv = new GlobalVarient();

            _varients.Add(gv);
            varlist.Items.Add(gv.Name);
            _vhash.Add(gv.Name, gv);
            varlist.SelectedItem = gv.Name;
            gv.NameChanged      += new EventHandler(gv_NameChanged);
//			prop.SelectedObject=gv;
        }
        private void CalcName(GlobalVarient value)
        {
            int    count = 1;
            string name  = "Var" + count.ToString();

            while (FindName(name))
            {
                count++;
                name = "Var" + count.ToString();
            }
            value.Name = name;
        }
Exemple #5
0
 public GlobalVarient(GlobalVarient gv)
 {
     _name  = gv.Name;
     _type  = gv.Type;
     _value = gv.Value;
 }
 private void UnRegisterVarientEvent(GlobalVarient value)
 {
     value.NameCheck -= new VarientNameCheckHandler(value_NameCheck);
     value.Validate  -= new VarientValidateHandler(value_Validate);
 }
 public bool Contains(GlobalVarient value)
 {
     return(this.InnerList.Contains(value));
 }
 public void Remove(GlobalVarient value)
 {
     this.InnerList.Remove(value);
 }