Skip to content

Commit

Permalink
Add tooltip.
Browse files Browse the repository at this point in the history
  • Loading branch information
n4ru committed Jul 12, 2018
1 parent 8d7e859 commit 08ae4a2
Showing 1 changed file with 32 additions and 29 deletions.
61 changes: 32 additions & 29 deletions FakeSlice.cs
Original file line number Diff line number Diff line change
@@ -1,34 +1,37 @@
using Lenovo.Modern.Portable.Battery;
using Native;
using System;

namespace ThinkBattery
{
class Program
{
static void Main(string[] args)
{

var batInterface = new BatteryInterface();
var chargeStatus = batInterface.QueryBattery(1).SmartBatteryStatus.ChargeStatus.GetValue();
var chargeStatusTwo = batInterface.QueryBattery(2).SmartBatteryStatus.ChargeStatus.GetValue();
var bat = new ChargeThreshold {
IsEnabled = true,
SlotNumber = 1,
StartValue = 0,
StopValue = 0
};
if (chargeStatus == "Charging" || chargeStatusTwo == "Charging") {
bat.StopValue = 1;
}
if (args.Length == 1 && args[0] == "on") {
bat.StopValue = 1;
} else if (args.Length == 1 && args[0] == "off") {
bat.StopValue = 0;
}
batInterface.SetChargeThreshold(bat);
bat.SlotNumber = 2;
batInterface.SetChargeThreshold(bat);
}
}
}
class Program
{
static void Main(string[] args)
{
var batInterface = new BatteryInterface();
var chargeStatus = batInterface.QueryBattery(1).SmartBatteryStatus.ChargeStatus.GetValue();
var chargeStatusTwo = batInterface.QueryBattery(2).SmartBatteryStatus.ChargeStatus.GetValue();
var notification = new System.Windows.Forms.NotifyIcon()
{
Visible = true,
Icon = System.Drawing.SystemIcons.Information,
BalloonTipTitle = "FakeSlice",
BalloonTipText = "Charging battery."
};
var bat = new ChargeThreshold {
IsEnabled = true,
SlotNumber = 1,
StartValue = 0,
StopValue = 0
};
if ((chargeStatus == "Charging" || chargeStatusTwo == "Charging") && (args.Length == 0 || (args.Length == 1 && args[0] != "off"))) {
bat.StopValue = 1;
notification.BalloonTipText = "Running on external power.";
}
batInterface.SetChargeThreshold(bat);
bat.SlotNumber = 2;
batInterface.SetChargeThreshold(bat);
notification.ShowBalloonTip(1000);
notification.Dispose();
}
}
}

0 comments on commit 08ae4a2

Please sign in to comment.