private void buttonAddRule_Click(object sender, EventArgs e) { hMailServer.Rule rule = _rulesCollection.Add(); formRule ruleDialog = new formRule(rule); if (ruleDialog.ShowDialog() == DialogResult.OK) { rule.Save(); ListRules(); } Marshal.ReleaseComObject(rule); }
private void EditSelectedItem() { if (listRules.SelectedItems.Count <= 0) { return; } int id = Convert.ToInt32(listRules.SelectedItems[0].Tag); hMailServer.Rule rule = _rulesCollection.get_ItemByDBID(id); formRule ruleDialog = new formRule(rule); ruleDialog.ShowDialog(this); if (ruleDialog.DialogResult == DialogResult.OK) { rule.Save(); ListRules(); } Marshal.ReleaseComObject(rule); }