예제 #1
0
        public void OpenFolderTest()
        {
            IPst    target   = CreateIPst(); // TODO: Initialize to an appropriate value
            string  name     = string.Empty; // TODO: Initialize to an appropriate value
            IFolder expected = null;         // TODO: Initialize to an appropriate value
            IFolder actual;

            actual = target.OpenFolder(name);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }
예제 #2
0
        private void foldersTreeView_AfterSelect(object sender, TreeViewEventArgs e)
        {
            if (String.IsNullOrEmpty(e.Node.Name))
            {
                return;
            }

            if (_isLoading)
            {
                _shouldCancel = true;
                this.foldersTreeView.SelectedNode = null;
                return;
            }

            try
            {
                _isLoading    = true;
                _shouldCancel = false;

                messagesListBox.SuspendLayout();
                Cursor = Cursors.WaitCursor;

                var nid = new NodeID();
                nid.Value = Convert.ToUInt32(e.Node.Name);

                IFolder f = _pst.OpenFolder(nid);
                messagesListBox.Items.Clear();

                int messageCount = f.MessageCount;
                int counter      = 0;
                int totalCounter = 0;
                messagesHeaderLabel.Text = "Messages (" + totalCounter + "/" + messageCount + ")";

                if (messageCount < 1)
                {
                    return;
                }

                foreach (IMessage message in f.Messages)
                {
                    string subject = string.Empty;

                    if (message.HasSubject)
                    {
                        try
                        {
                            subject = message.Subject;
                        }
                        catch
                        {
                            subject = "<error retrieving subject>";
                        }
                    }

                    messagesListBox.Items.Add(
                        new ListViewItem(
                            new[] { message.Node.Value.ToString(), subject, message.Size.ToString() }, string.Empty)
                    {
                        Tag = message.Node.Value
                    });

                    if (_shouldCancel)
                    {
                        messagesListBox.Items.Clear();
                        break;
                    }
                    totalCounter++;
                    counter++;
                    if (counter == 50)
                    {
                        messagesListBox.ResumeLayout();
                        messagesHeaderLabel.Text = "Messages (" + totalCounter + "/" + messageCount + ")";
                        Application.DoEvents();
                        counter = 0;
                        messagesListBox.SuspendLayout();
                    }
                }
                messagesHeaderLabel.Text = "Messages (" + totalCounter + "/" + messageCount + ")";
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error completing requested action.\r\n\r\n" + ex.Message + "\r\n" + ex.StackTrace);
            }
            finally
            {
                Cursor = Cursors.Default;
                messagesListBox.ResumeLayout();
                _isLoading = false;
            }
        }