示例#1
0
        private void EditSelectedBlockedAttachment()
        {
            if (listBlockedAttachments.SelectedItems.Count < 0)
                return;

            int id = Convert.ToInt32(listBlockedAttachments.SelectedItems[0].Tag);

            hMailServer.Settings settings = APICreator.Settings;
            hMailServer.AntiVirus antiVirusSettings = settings.AntiVirus;
            hMailServer.BlockedAttachments attachments = antiVirusSettings.BlockedAttachments;
            hMailServer.BlockedAttachment ba = attachments.get_ItemByDBID(id);

            formBlockedAttachment blockedDlg = new formBlockedAttachment();

            blockedDlg.LoadProperties(ba);

            if (blockedDlg.ShowDialog() == DialogResult.OK)
            {
                blockedDlg.SaveProperties(ba);
                ba.Save();
            }

            Marshal.ReleaseComObject(settings);
            Marshal.ReleaseComObject(antiVirusSettings);
            Marshal.ReleaseComObject(attachments);
            Marshal.ReleaseComObject(ba);

            ListBlockedAttachments();
        }
示例#2
0
        private void buttonAddBlockedAttachment_Click(object sender, EventArgs e)
        {
            formBlockedAttachment blockedDlg = new formBlockedAttachment();

            if (blockedDlg.ShowDialog() == DialogResult.OK)
            {
                hMailServer.Settings settings = APICreator.Application.Settings;
                hMailServer.AntiVirus antiVirusSettings = settings.AntiVirus;
                hMailServer.BlockedAttachments attachments = antiVirusSettings.BlockedAttachments;

                hMailServer.BlockedAttachment ba = attachments.Add();
                blockedDlg.SaveProperties(ba);
                ba.Save();

                Marshal.ReleaseComObject(ba);
                Marshal.ReleaseComObject(settings);
                Marshal.ReleaseComObject(antiVirusSettings);
                Marshal.ReleaseComObject(attachments);
            }

            ListBlockedAttachments();
        }