コード例 #1
0
        /// <summary>
        /// Button properties click.
        /// </summary>
        /// <param name="sender">The sender object.</param>
        /// <param name="e">The event arguments.</param>
        private void btnProperties_Click(object sender, EventArgs e)
        {
            if (lstAccounts.SelectedIndex >= 0)
            {
                AccountSettings.AccountInfo accountInfo =
                    (AccountSettings.AccountInfo)(this.lstAccounts.SelectedItem);

                AddAccountWizardForm frmAdd = new AddAccountWizardForm();
                frmAdd.NewAccountInfo = accountInfo;
                DialogResult dr = frmAdd.ShowDialog();
                if (dr == DialogResult.OK)
                {
                    Facade.GetInstance().SaveAccountSettings();
                    this.LoadAccoutnSetings();
                }
            }
        }
コード例 #2
0
        /// <summary>
        /// After label edit event.
        /// </summary>
        /// <param name="sender">The sender object.</param>
        /// <param name="e">The event arguments.</param>
        private void folderTreeView_AfterLabelEdit(object sender, NodeLabelEditEventArgs e)
        {
            Facade       facade       = Facade.GetInstance();
            MessageStore messageStore = facade.GetMessageStoreCustom();

            foreach (MailMessage mail in messageStore.Messages)
            {
                if (mail.ParentFolder.Equals(e.Node.Text))
                {
                    mail.ParentFolder = e.Label;
                }
            }

            e.Node.Text = e.Label;
            this.folderTreeView_AfterSelect(this.folderTreeView, new TreeViewEventArgs(e.Node));
            this.SaveFolders();
        }
コード例 #3
0
        /// <summary>
        /// Method for delete the tree nodes recursively.
        /// </summary>
        /// <param name="node">The tree node for delete.</param>
        public void DeleteNodesRecursive(TreeNode node)
        {
            foreach (TreeNode child in node.Nodes)
            {
                this.DeleteNodesRecursive(child);
            }

            Facade       facade       = Facade.GetInstance();
            MessageStore messageStore = facade.GetMessageStoreCustom();

            for (int i = 0; i < messageStore.Messages.Count; i++)
            {
                MailMessage mail = messageStore.Messages[i];
                if (mail.ParentFolder.Equals(node.Text))
                {
                    messageStore.Messages.Remove(mail);
                }
            }

            node.Remove();
        }
コード例 #4
0
        /// <summary>
        /// Event for refresh the mailbox and messages.
        /// </summary>
        /// <param name="sender">The sender object.</param>
        /// <param name="e">The event arguments.</param>
        private void refreshToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Facade facade = Facade.GetInstance();

            // Retrieve messages from inbox mailbox.
            facade.LoadMessageStore(Constants.Inbox, facade.GetMessageStore());
            facade.RetrieveMessages(Constants.Inbox);

            // Retrieve messages from sent item mailbox.
            facade.LoadMessageStore(Constants.SentItems, facade.GetMessageStoreSent());

            // Retrieve messages from deleted item mailbox.
            facade.LoadMessageStore(Constants.DeletedItems, facade.GetMessageStoreDelete());

            // Retrieve messages from custom items mailbox.
            facade.LoadMessageStore(Constants.CustomFolders, facade.GetMessageStoreCustom());

            // Setup Message Server
            MessageStore messageStore = facade.GetMessageStore();

            // load the selected message
            this.LoadSelectedMessage(facade.GetMessageStore());
        }
コード例 #5
0
        /// <summary>
        /// Event for paint Main Frame.
        /// verify the loadFirstMessageFlag and load the first selected message properly.
        /// This was done in order to fix the bug reported in msdn:
        /// http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=115341
        /// Related with Web Browser: DocumentStream.
        /// </summary>
        /// <param name="sender">The sender object.</param>
        /// <param name="e">The event arguments.</param>
        private void MainForm_Paint(object sender, PaintEventArgs e)
        {
            if (loadFirstMessageFlag)
            {
                // load the selected message
                this.LoadSelectedMessage(Facade.GetInstance().GetMessageStore());
                loadFirstMessageFlag = false;
            }

            // TODO - test
            //Facade facade = Facade.GetInstance();
            //if (facade.reload)
            //{

            //    MessageStore messageStore = facade.GetMessageStore();
            //    MessageStore retrievedMessages = facade.StoreRetrieved;
            //    foreach (MailMessage mailMessage in retrievedMessages.Messages)
            //    {
            //        if (!messageStore.Messages.Contains(mailMessage))
            //        {
            //            messageStore.Messages.Add(mailMessage);
            //            messageStore.UnreadCount++;
            //        }
            //    }
            //    facade.reload = false;

            //    //if (loadFirstMessageFlag)
            //    //{
            //    //    // load the selected message
            //    //    this.LoadSelectedMessage(Facade.GetInstance().GetMessageStore());
            //    //    loadFirstMessageFlag = false;
            //    //}

            //    //this.messageArea1.MessageList.Invalidate(true);
            //}
        }
コード例 #6
0
        /// <summary>
        /// Method for load messages.
        /// </summary>
        /// <param name="messageListType">The Message List Type.</param>
        public void LoadMessages(MessageListType messageListType)
        {
            Facade facade         = Facade.GetInstance();
            string selectedFolder = string.Empty;

            if (messageListType == MessageListType.Inbox ||
                messageListType == MessageListType.Unread ||
                messageListType == MessageListType.Read)
            {
                // Attach to Message Store
                this._store = facade.GetMessageStore();
            }
            else if (messageListType == MessageListType.SentItems)
            {
                // Attach to Message Store Sent items
                this._store = facade.GetMessageStoreSent();
            }
            else if (messageListType == MessageListType.DeletedItems)
            {
                // Attach to Message Store Sent items
                this._store = facade.GetMessageStoreDelete();
            }
            else if (messageListType == MessageListType.Custom)
            {
                // Attach to Message Store Sent items
                this._store    = facade.GetMessageStoreCustom();
                selectedFolder = MainForm.GetInstance().GetSelectedFolder();
            }
            else
            {
                this._store = new MessageStore();
            }

            // Reset DataSource
            this.messageBS.DataSource    = this._store.Messages;
            this.dataGridView.DataSource = this.messageBS;

            this.dataGridView.CurrentCell = null;

            CurrencyManager cm = (CurrencyManager)this.dataGridView.BindingContext[this.dataGridView.DataSource];

            cm.SuspendBinding();

            foreach (DataGridViewRow row in this.dataGridView.Rows)
            {
                MailMessage mailMessage = (MailMessage)row.DataBoundItem;

                if (messageListType == MessageListType.Unread && mailMessage.Read)
                {
                    row.Visible = false;
                }
                else if (messageListType == MessageListType.Read && !mailMessage.Read)
                {
                    row.Visible = false;
                }
                else if (messageListType == MessageListType.Custom &&
                         !mailMessage.ParentFolder.Equals(selectedFolder))
                {
                    row.Visible = false;
                }
                else
                {
                    row.Visible = true;
                }
            }

            cm.ResumeBinding();

            if (this.messageBS.Count > 0)
            {
                this.dataGridView.Sort(this.dataGridView.Columns[2], ListSortDirection.Descending);
            }

            MainForm mainForm = this.ParentForm as MainForm;

            mainForm.LoadSelectedMessage(this._store);

            this.Invalidate(true);
        }