Exemple #1
0
        public void Check(MailCheckAction action)
        {
            BackgroundWorker mailCheckWorker = new BackgroundWorker();
            mailCheckWorker.DoWork += new DoWorkEventHandler(mailCheckWorker_DoWork);
            mailCheckWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(mailCheckWorker_CompletedEvent);

            mailCheckWorker.RunWorkerAsync(action);
        }
Exemple #2
0
 void getNewMailCount(MailCheckAction action)
 {
     gmail.Check(action);
 }
Exemple #3
0
        void finishedCheckingMail(int mailCountResult, MailCheckAction action)
        {
            newMailCount = mailCountResult;

            //check if error
            if (newMailCount == -1)
                printError("Error while checking for new mail.", gmail.mailException);
            else
            {
                //perform designated action
                switch (action)
                {
                    case MailCheckAction.MailInit:
                        if (newMailCount != -1)
                        {
                            displayNewMailCount();
                            timerMailCheck.Enabled = true;
                        }
                        break;
                    case MailCheckAction.TimerCheck:
                        if (mailUpdateOnNewMail)
                            displayNewMailCount();
                        break;
                    case MailCheckAction.ForceOutput:
                        prevNewMailCount = -1; //force the mail count to display even if it's zero
                        displayNewMailCount();
                        break;
                }
            }
        }