Ejemplo n.º 1
0
 private void CheckMail()
 {
     try
     {
         int      NewUnreadMail                 = 0;
         DateTime LastUnreadMailDate            = DateTime.MinValue;
         Collection <UnreadMails> clUnreadMails = GetNewMails();
         for (int i = 0; i < clUnreadMails.Count; i++)
         {
             if (clUnreadMails[i].MailModify > LastCheck)
             {
                 NewUnreadMail++;
             }
             if (clUnreadMails[i].MailModify > LastUnreadMailDate)
             {
                 LastUnreadMailDate = clUnreadMails[i].MailModify;
             }
         }
         LastCheck = LastUnreadMailDate;
         lblTotalUnreadNum.Text = clUnreadMails.Count.ToString();
         lblLastUnreadNum.Text  = NewUnreadMail.ToString();
     }
     catch
     {
         if (MailTimer.Enabled)
         {
             MailTimer.Stop();
         }
         MessageBox.Show("Error retrieving unread count!", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Ejemplo n.º 2
0
 private void EnableUnreadCount_CheckedChanged(object sender, EventArgs e)
 {
     if (EnableUnreadCount.Checked)
     {
         pulse           = true;
         Pulse.ForeColor = Color.DodgerBlue;
         Pulse.Enabled   = false;
         light           = false;
         Light.ForeColor = Color.Gray;
         Light.Enabled   = false;
         if (PulseTimer.Enabled)
         {
             PulseTimer.Stop();
         }
         if (!MailTimer.Enabled)
         {
             MailTimer.Start();
         }
     }
     else
     {
         pulse           = false;
         Pulse.ForeColor = Color.Gray;
         Pulse.Enabled   = true;
         light           = false;
         Light.ForeColor = Color.Gray;
         Light.Enabled   = true;
         if (usb.colortimer.Enabled)
         {
             usb.colortimer.Stop();
         }
         if (usb.colorchanger.Enabled)
         {
             usb.colorchanger.Stop();
         }
         if (PulseTimer.Enabled)
         {
             PulseTimer.Stop();
         }
         if (MailTimer.Enabled)
         {
             MailTimer.Stop();
         }
     }
 }