/// <summary>
 /// Copy To the generic battery state
 /// </summary>
 /// <param name="genericBattery"></param>
 public pxbattery.BatteryState SyncGenericState(ref pxbattery.BatteryState genericBattery)
 {
     genericBattery.MaxBatteryPower        = MaxVoltage;
     genericBattery.PercentBatteryPower    = PercentBatteryPower;
     genericBattery.PercentCriticalBattery = CriticalBatteryVoltage / MaxVoltage;
     return(genericBattery);
 }
 /// <summary>
 /// Copy From the generic battery state
 /// </summary>
 /// <param name="genericBattery"></param>
 public void CopyFrom(pxbattery.BatteryState genericBattery)
 {
     MaxVoltage             = genericBattery.MaxBatteryPower;
     CriticalBatteryVoltage = MaxVoltage * genericBattery.PercentCriticalBattery;
     PercentBatteryPower    = genericBattery.PercentBatteryPower;
     CurrentBatteryVoltage  = MaxVoltage * PercentBatteryPower;
 }
Esempio n. 3
0
 /// <summary>
 /// Updates the battery level.
 /// </summary>
 /// <param name="batteryState">State of the battery.</param>
 public void UpdateBatteryLevel(battery.BatteryState batteryState)
 {
     if (batteryState == null)
     {
         this.BatteryLevelTxt.Text = "No battery";
     }
     else
     {
         this.BatteryLevelTxt.Text   = ((int)batteryState.PercentBatteryPower) + "%";
         this.BatteryLevel.Value     = Math.Min(this.BatteryLevel.Maximum, (int)batteryState.PercentBatteryPower);
         this.BatteryLevel.ForeColor = batteryState.PercentBatteryPower > batteryState.PercentCriticalBattery
                                           ? SystemColors.Highlight
                                           : Color.Red;
     }
 }
Esempio n. 4
0
 public void ReplaceHandler(battery.Replace replace)
 {
     this.batteryState = replace.Body;
     replace.ResponsePort.Post(DefaultReplaceResponseType.Instance);
     SendNotification(this.batterySubMgr, replace);
 }