예제 #1
0
        private void Worker_DoWork(object sender, DoWorkEventArgs e)
        {
            using (PopChat chat = new PopChat(this))
            {
                chat.Nothing.Execute();
                chat.User.Execute(this.Username);
                chat.Pass.Execute(this.Password);
                chat.Stat.Execute();

                this.OnMailPopInfoFetched(chat.Stat.Count, chat.Stat.Size);

                for (int fetchIndex = 1; fetchIndex <= chat.Stat.Count; fetchIndex++)
                {
                    if (worker.CancellationPending)
                    {
                        e.Cancel = true;
                        break;
                    }

                    chat.List.Execute(fetchIndex);
                    chat.Uidl.Execute(fetchIndex);
                    chat.Retr.Execute(fetchIndex);
                    this.OnMailPopped(fetchIndex, chat.Retr.Message, chat.List.Size, chat.Uidl.Uidl, chat.Retr.ReceivedTime);

                    if (this.DeleteMailAfterPop)
                    {
                        chat.Dele.Execute(fetchIndex);
                    }
                }

                chat.Quit.Execute();
            }
        }
예제 #2
0
        private void Worker_DoWork(object sender, DoWorkEventArgs e)
        {
            using (PopChat chat = new PopChat(this))
            {
                chat.Nothing.Execute();
                chat.User.Execute(this.Username);
                chat.Pass.Execute(this.Password);
                chat.Stat.Execute();

                this.OnMailPopInfoFetched(chat.Stat.Count, chat.Stat.Size);

                for (int fetchIndex = 1; fetchIndex <= chat.Stat.Count; fetchIndex++)
                {
                    if (worker.CancellationPending)
                    {
                        e.Cancel = true;
                        break;
                    }

                    chat.List.Execute(fetchIndex);
                    chat.Uidl.Execute(fetchIndex);
                    chat.Retr.Execute(fetchIndex);
                    this.OnMailPopped(fetchIndex, chat.Retr.Message, chat.List.Size, chat.Uidl.Uidl, chat.Retr.ReceivedTime);

                    if (this.DeleteMailAfterPop)
                    {
                        chat.Dele.Execute(fetchIndex);
                    }
                }

                chat.Quit.Execute();
            }
        }