예제 #1
0
        private void btnDel_Click(object sender, System.EventArgs e)
        {
            ListView.SelectedListViewItemCollection items = ListViewMail.SelectedItems;
            if (items.Count == 0)
            {
                return;
            }

            if (MessageBox.Show("Do you want to delete all selected emails",
                                "",
                                MessageBoxButtons.YesNo) == DialogResult.No)
            {
                return;
            }

            while (items.Count > 0)
            {
                try
                {
                    string fileName = items[0].Tag as string;
                    File.Delete(fileName);

                    string htmlFile         = _getHtmlRenderFile(fileName);
                    string attachmentFolder = _getAttachmentFolder(fileName);

                    if (File.Exists(htmlFile))
                    {
                        File.Delete(htmlFile);
                    }

                    if (Directory.Exists(attachmentFolder))
                    {
                        Directory.Delete(attachmentFolder, true);
                    }

                    ListViewMail.Items.Remove(items[0]);
                }
                catch (Exception ep)
                {
                    MessageBox.Show(ep.Message);
                    break;
                }
            }

            LabelTotal.Text = string.Format("Total {0} email(s)", ListViewMail.Items.Count);
            WebMail.Navigate("about:blank");
        }
예제 #2
0
        private void _showMail(string fileName)
        {
            try
            {
                string htmlFile = _getHtmlRenderFile(fileName);

                if (!File.Exists(htmlFile))
                {   // we haven't generate the html for this email, generate it now.
                    _GenerateHtmlForEmail(fileName);
                }

                WebMail.Navigate(htmlFile);
            }
            catch (Exception ep)
            {
                MessageBox.Show(ep.Message);
            }
        }
예제 #3
0
        private void Form1_Load(object sender, System.EventArgs e)
        {
            _initCurrentPath();
            _initControlOffset();
            _initOauthWrapper();

            WebMail.Navigate("about:blank");

            // initialize authentication type
            ComboBoxAuthType.Items.Add("USER/LOGIN");
            ComboBoxAuthType.Items.Add("APOP");
            ComboBoxAuthType.Items.Add("NTLM");
            ComboBoxAuthType.Items.Add("Gmail XOAUTH2");

            ComboBoxAuthType.SelectedIndex = 0;

            // initialize mail date range
            ComboBoxDateRange.Items.Add("All emails");
            ComboBoxDateRange.Items.Add("Last 7 days");
            ComboBoxDateRange.Items.Add("Last 30 days");
            ComboBoxDateRange.Items.Add("Last 60 days");
            ComboBoxDateRange.Items.Add("Last 90 days");

            ComboBoxDateRange.SelectedIndex = 0;

            // initialize protocols.
            ComboBoxProtocol.Items.Add("POP3");
            ComboBoxProtocol.Items.Add("IMAP4");
            ComboBoxProtocol.Items.Add("EWS - Exchange 2007-2019/Office365");
            ComboBoxProtocol.Items.Add("WebDAV - Exchange 2000/2003");

            ComboBoxProtocol.SelectedIndex = 0;


            ListViewMail.Sorting            = SortOrder.Descending;
            ListViewMail.ListViewItemSorter = new ListMailItemCompare();

            _loadLocalMails();
            LabelTotal.Text = string.Format("Total {0} email(s)", ListViewMail.Items.Count);
        }