private void button_EditGroup_Click(object sender, EventArgs e) { var gname = comboBox_Group.Text; var form = new GroupEditorForm(); form.Data = gname; var result = form.ShowDialog(); if (result == DialogResult.OK) { string new_gname = form.Data; if (comboBox_Group.Items.Contains(gname)) { // // Update CnofigData // var glist = ConfigData.Group; if (glist.ContainsKey(gname)) { var apps = glist[gname]; if (form.CloneFlag == false) { glist.Remove(gname); glist[new_gname] = apps; } else { glist[new_gname] = CloneObject(apps); } } // // Update UI // comboBox_Group_Event_Enable = false; var index = comboBox_Group.Items.IndexOf(gname); if (form.CloneFlag == false) { comboBox_Group.Items[index] = new_gname; } else { comboBox_Group.Items.Add(new_gname); } comboBox_Group_Event_Enable = true; } RefreshComboBoxGroup(); RefreshGroupToolStripMenu(); } }
private void button_AddGroup_Click(object sender, EventArgs e) { var Form = new GroupEditorForm(); Form.Data = ""; var result = Form.ShowDialog(); if (result == DialogResult.OK) { string Data = Form.Data; if (comboBox_Group.Items.Contains(Data)) { MessageBox.Show("Data already exists", "ERROR"); } else { comboBox_Group.Items.Add(Data); var glist = ConfigData.Group; glist[Data] = new JArray(); } RefreshGroupToolStripMenu(); } }