private void UpdateInfomation()
        {
            var info = BatteryInfo.GetBatteryInformation();

            DesignCapacity.Text     = info.DesignedMaxCapacity.ToString("#,0") + " mWh";
            FullChargeCapacity.Text = info.FullChargeCapacity.ToString("#,0") + " mWh";
            CurrentCapacity.Text    = info.CurrentCapacity.ToString("#,0") + " mWh";
            BatteryVoltage.Text     = info.Voltage.ToString("#,0") + " mv";
        }
コード例 #2
0
 public void DispatcherTimer_Tick(object sender, EventArgs e)
 {
     if (IsPluggedAcAdapter())
     {
         var info = BatteryInfo.GetBatteryInformation();
         if (info.CurrentCapacity >= info.DesignedMaxCapacity * 0.95 || GetButteryPercentage() >= 95)
         {
             MessageBox.Show("Charging is completed. Please unplug the AC adapter.",
                             "Warning",
                             MessageBoxButton.OK, MessageBoxImage.Warning,
                             MessageBoxResult.OK,
                             MessageBoxOptions.ServiceNotification);
         }
     }
 }