Загрузка...

How to understand the program is running on a Stationary Computer or on a laptop?

Thread in C# created by ALEGOR Jan 3, 2020. 139 views

  1. ALEGOR
    ALEGOR Topic starter Jan 3, 2020 tetsa
  2. FormatC
    FormatC Jan 17, 2020 Banned 128 Jul 4, 2019
    Можно сделать проверку через состояние батареи ноутбука:
    Code

    switch (SystemInformation.PowerStatus.BatteryChargeStatus)
    {
    case System.Windows.Forms.BatteryChargeStatus.Low:
    MessageBox.Show("Battery is running low.", "Low Battery", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
    break;
    case System.Windows.Forms.BatteryChargeStatus.Critical:
    MessageBox.Show("Battery is critcally low.", "Critical Battery", MessageBoxButtons.OK, MessageBoxIcon.Stop);
    break;
    default:
    // Battery is okay.
    break;
    }
    Соответственно всё это занести в try и если батареи не будет - стационарный пк.
     
Top
Loading...