private void EditSelectedExternalAccount() { if (listFetchAccounts.SelectedItems.Count < 1) { return; } int id = Convert.ToInt32(listFetchAccounts.SelectedItems[0].Tag); hMailServer.FetchAccounts fetchAccounts = _representedAccount.FetchAccounts; hMailServer.FetchAccount fetchAccount = fetchAccounts.get_ItemByDBID(id); formExternalAccount externalAccountDialog = new formExternalAccount(); externalAccountDialog.LoadAccountProperties(fetchAccount); if (externalAccountDialog.ShowDialog() == DialogResult.OK) { externalAccountDialog.SaveAccountProperties(fetchAccount); fetchAccount.Save(); } ListExternalAccounts(); Marshal.ReleaseComObject(fetchAccounts); Marshal.ReleaseComObject(fetchAccount); }
private void buttonAddExternalAccount_Click(object sender, EventArgs e) { formExternalAccount externalAccountDialog = new formExternalAccount(); if (externalAccountDialog.ShowDialog() == DialogResult.OK) { hMailServer.FetchAccounts fetchAccounts = _representedAccount.FetchAccounts; hMailServer.FetchAccount fetchAccount = _representedAccount.FetchAccounts.Add(); Marshal.ReleaseComObject(fetchAccounts); externalAccountDialog.SaveAccountProperties(fetchAccount); fetchAccount.Save(); Marshal.ReleaseComObject(fetchAccount); ListExternalAccounts(); } }