Пример #1
0
 /// <summary>
 /// This is called when the battery state changes.
 /// </summary>
 /// <param name="obj"></param>
 private void pWiiProvider_OnStatusUpdate(WiimoteStatus status)
 {
     // Dispatch it.
     Dispatcher.BeginInvoke(new Action(delegate()
     {
         statusStackMutex.WaitOne();
         foreach (UIElement child in this.statusStack.Children)
         {
             WiimoteStatusUC uc = (WiimoteStatusUC)child;
             if (uc.ID == status.ID)
             {
                 uc.updateStatus(status);
             }
         }
         statusStackMutex.ReleaseMutex();
     }), null);
 }
Пример #2
0
 public void updateStatus(WiimoteStatus status)
 {
     //this.lbId.Content = "" + status.ID;
     if (this.battery != status.Battery)
     {
         this.battery = status.Battery;
         this.setBattery(status.Battery);
     }
     if (this.powersave != status.InPowerSave)
     {
         this.powersave = status.InPowerSave;
         if (status.InPowerSave)
         {
             this.lbStatus.Foreground = Brushes.White;
             this.lbStatus.Content    = "sleepmode";
         }
         else
         {
             this.lbStatus.Foreground = new SolidColorBrush(Color.FromRgb(91, 255, 0));
             this.lbStatus.Content    = "connected";
         }
     }
 }