/// <summary> /// Edits the selected rule /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void editButton_Click(object sender, EventArgs e) { if (listBox1.SelectedItem == null) { return; } try { // grab the current rule MacFilterModule.MacRule new_rule = (MacFilterModule.MacRule)listBox1.Items[listBox1.SelectedIndex]; // grab its idx int idx = listBox1.SelectedIndex; AddEditMacRule aer = new AddEditMacRule(new_rule); if (aer.ShowDialog() == DialogResult.OK) { // replace rule listBox1.Items[idx] = aer.newRule; List <MacFilterModule.MacRule> r = new List <MacFilterModule.MacRule>(); foreach (object rule in listBox1.Items) { r.Add((MacFilterModule.MacRule)rule); } mf.InstanceGetRuleUpdates(r); aer.Dispose(); } } catch (Exception exception) { LogCenter.Instance.LogException(exception); } }
private void button1_Click_1(object sender, EventArgs e) { try { AddEditMacRule aer = new AddEditMacRule(); if (aer.ShowDialog() == DialogResult.OK) { listBox1.Items.Add(aer.newRule); List <MacFilterModule.MacRule> r = new List <MacFilterModule.MacRule>(); foreach (object rule in listBox1.Items) { r.Add((MacFilterModule.MacRule)rule); } mf.InstanceGetRuleUpdates(r); } aer.Dispose(); } catch (Exception exception) { LogCenter.Instance.LogException(exception); } }
private void button1_Click_1(object sender, EventArgs e) { try { AddEditMacRule aer = new AddEditMacRule(); if (aer.ShowDialog() == DialogResult.OK) { listBox1.Items.Add(aer.newRule); List<MacFilterModule.MacRule> r = new List<MacFilterModule.MacRule>(); foreach (object rule in listBox1.Items) { r.Add((MacFilterModule.MacRule)rule); } mf.InstanceGetRuleUpdates(r); } aer.Dispose(); } catch (Exception exception) { LogCenter.Instance.LogException(exception); } }
/// <summary> /// Edits the selected rule /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void editButton_Click(object sender, EventArgs e) { if (listBox1.SelectedItem == null ) return; try { // grab the current rule MacFilterModule.MacRule new_rule = (MacFilterModule.MacRule)listBox1.Items[listBox1.SelectedIndex]; // grab its idx int idx = listBox1.SelectedIndex; AddEditMacRule aer = new AddEditMacRule(new_rule); if (aer.ShowDialog() == DialogResult.OK) { // replace rule listBox1.Items[idx] = aer.newRule; List<MacFilterModule.MacRule> r = new List<MacFilterModule.MacRule>(); foreach (object rule in listBox1.Items) { r.Add((MacFilterModule.MacRule)rule); } mf.InstanceGetRuleUpdates(r); aer.Dispose(); } } catch (Exception exception) { LogCenter.Instance.LogException(exception); } }