Ejemplo n.º 1
0
 private void Refresh_Tick(object sender, EventArgs e)
 {
     if (!this.usb.hidDevice.IsOpen)
     {
         usbStatus.Image = Properties.Resources.usb_error;
         if (RefreshRate.Enabled)
         {
             this.RefreshRate.Stop();
         }
     }
     this.labelR.Text     = this.R.Value.ToString();
     this.labelG.Text     = this.G.Value.ToString();
     this.labelB.Text     = this.B.Value.ToString();
     this.SpeedLabel.Text = this.Speed.Value.ToString();
     if (this.PulseTimer.Interval != Speed.Value * 200 && this.PulseTimer.Interval != 1)
     {
         this.PulseTimer.Interval = Speed.Value * 200;
         usb.IntervalChange(Speed.Value);
     }
     if (light)
     {
         byte r = (byte)this.R.Value;
         byte g = (byte)this.G.Value;
         byte b = (byte)this.B.Value;
         if (this.usb != null)
         {
             this.usb.SetRGB(r, g, b);
         }
     }
     else if (!pulse)
     {
         if (this.usb != null)
         {
             this.usb.SetRGB(0x00, 0x00, 0x00);
         }
     }
     try
     {
         if (EnableUnreadCount.Checked && Convert.ToInt64(lblTotalUnreadNum.Text) > 0 && !PulseTimer.Enabled)
         {
             Pulse.Enabled = true;
             Pulse.PerformClick();
             Pulse.Enabled = false;
         }
         else if (EnableUnreadCount.Checked && Convert.ToInt64(lblTotalUnreadNum.Text) == 0 && PulseTimer.Enabled)
         {
             Pulse.Enabled = true;
             Pulse.PerformClick();
             Pulse.Enabled = false;
         }
     }
     catch
     {
     }
 }