Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        private void ListExternalAccounts()
        {
            listFetchAccounts.Items.Clear();

            hMailServer.FetchAccounts fetchAccounts = _representedAccount.FetchAccounts;

            for (int i = 0; i < fetchAccounts.Count; i++)
            {
                hMailServer.FetchAccount fetchAccount = fetchAccounts.get_Item(i);

                string name    = fetchAccount.Name;
                string enabled = EnumStrings.GetYesNoString(fetchAccount.Enabled);

                ListViewItem item = listFetchAccounts.Items.Add(name);
                item.SubItems.Add(enabled);

                if (fetchAccount.Enabled)
                {
                    item.SubItems.Add(fetchAccount.NextDownloadTime);
                }

                item.Tag = fetchAccount.ID;

                Marshal.ReleaseComObject(fetchAccount);
            }
        }
Ejemplo n.º 3
0
        private void buttonDeleteExternalAccount_Click(object sender, EventArgs e)
        {
            hMailServer.FetchAccounts fetchAccounts = _representedAccount.FetchAccounts;

            foreach (ListViewItem item in listFetchAccounts.SelectedItems)
            {
                int id = Convert.ToInt32(item.Tag);

                fetchAccounts.DeleteByDBID(id);
            }

            Marshal.ReleaseComObject(fetchAccounts);

            ListExternalAccounts();
        }
Ejemplo n.º 4
0
        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();
            }
        }