コード例 #1
0
ファイル: ScheduledAgent.cs プロジェクト: deucks/Battery-Guru
        public void addBatteryStatus()
        {
            ViewModel batteryModel = new ViewModel();

            batteryModel.add(SystemEndPoints.currentBatteryLevel(), SystemEndPoints.isWifiOn(), SystemEndPoints.isPhoneOn(), SystemEndPoints.isLocationEnabled(), SystemEndPoints.isCharging(), SystemEndPoints.isAirplaneOn(), SystemEndPoints.isInternetOn(), SystemEndPoints.isOverDataLimit(), SystemEndPoints.isRoaming());

            Debug.WriteLine("Background");
        }
コード例 #2
0
        public void setup()
        {
            bool isCharging = SystemEndPoints.isCharging();

            ChargeStatus.Text = SystemEndPoints.currentBatteryLevel() + "%";

            double chargeLevel = SystemEndPoints.currentBatteryLevel();

            backgroundStatus.Width = (chargeLevel / 100) * 241;
        }
コード例 #3
0
ファイル: ScheduledAgent.cs プロジェクト: deucks/Battery-Guru
 public void giveBatteryFullToast()
 {
     if (SystemEndPoints.currentBatteryLevel() > 99 && SystemEndPoints.isCharging())
     {
         ShellToast toast = new ShellToast();
         toast.Title   = "BatteryGuru";
         toast.Content = "You can unplug me.";
         toast.Show();
     }
 }
コード例 #4
0
        public void setup()
        {
            bool isCharging = SystemEndPoints.isCharging();

            if (isCharging)
            {
                string chargeString = SystemEndPoints.calculateChargeRateString("in");
                if (chargeString.Contains("calculating"))
                {
                    ChargeStatusDescription.Text = "Calculating...";
                    Discharging.Text             = "please wait";
                    PowerOffAt.Text = "";
                }
                else if (chargeString.Contains("fully"))
                {
                    ChargeStatusDescription.Text = "Fully charged";
                    Discharging.Text             = "you can unplug me";
                    PowerOffAt.Text = "";
                }
                else
                {
                    ChargeStatusDescription.Text = "Charging...";
                    Discharging.Text             = "fully charged in " + SystemEndPoints.calculateChargeRateString("in") + ", ";
                    PowerOffAt.Text = "at " + SystemEndPoints.calculateChargeRateString("at");;
                }
            }
            else
            {
                string chargeString = SystemEndPoints.getTimeTillPowerOff();
                if (chargeString.Contains("calculating"))
                {
                    ChargeStatusDescription.Text = "Calculating...";
                    Discharging.Text             = "please wait";
                    PowerOffAt.Text = "";
                }
                else if (chargeString.Contains("fully"))
                {
                    ChargeStatusDescription.Text = "Fully charged";
                    Discharging.Text             = "you can unplug me";
                    PowerOffAt.Text = "";
                }
                else
                {
                    ChargeStatusDescription.Text = SystemEndPoints.getTimeTillPowerOff() + " left";
                    Discharging.Text             = "discharging at " + SystemEndPoints.getTimeRatio();
                    PowerOffAt.Text = "power off at " + SystemEndPoints.getPowerOffTime();
                }
            }

            ChargeStatus.Text = SystemEndPoints.currentBatteryLevel().ToString();

            double chargeLevel = SystemEndPoints.currentBatteryLevel();

            backgroundStatus.Width = (chargeLevel / 100) * 70;
        }
コード例 #5
0
ファイル: MainPage.xaml.cs プロジェクト: deucks/Battery-Guru
        public void updateUI()
        {
            int currentStatus = SystemEndPoints.currentBatteryLevel();

            System.Windows.Deployment.Current.Dispatcher.BeginInvoke(() =>
            {
                ChargingStatusBar.Value = currentStatus;
                ChargeStatus.Text       = currentStatus + "%";
            });

            //updateDetailedListUI();
        }
コード例 #6
0
ファイル: ScheduledAgent.cs プロジェクト: deucks/Battery-Guru
        public void giveBatteryLowToast()
        {
            Settings appSettings  = new Settings();
            int      lowThreshold = appSettings.getSettingsInt(appSettings.LowBatteryThreshold);

            if (SystemEndPoints.currentBatteryLevel() < lowThreshold)
            {
                ShellToast toast = new ShellToast();
                toast.Title   = "BatteryGuru";
                toast.Content = "Low battery, < " + lowThreshold + "% left";
                toast.Show();
            }
        }
コード例 #7
0
        public void setup()
        {
            bool isCharging = SystemEndPoints.isCharging();

            if (isCharging)
            {
                string chargeString = SystemEndPoints.calculateChargeRateString("in");
                if (chargeString.Contains("calculating"))
                {
                    ChargeStatusDescription.Text = "calculating...";
                }
                else if (chargeString.Contains("fully"))
                {
                    ChargeStatusDescription.Text = "fully charged";
                }
                else
                {
                    ChargeStatusDescription.Text = "charging...";
                }
            }
            else
            {
                string chargeString = SystemEndPoints.getTimeTillPowerOff();
                if (chargeString.Contains("calculating"))
                {
                    ChargeStatusDescription.Text = "calculating...";
                }
                else if (chargeString.Contains("fully"))
                {
                    ChargeStatusDescription.Text = "fully charged";
                }
                else
                {
                    ChargeStatusDescription.Text = SystemEndPoints.getTimeTillPowerOff() + " left";
                }
            }
            ChargeStatus.Text = SystemEndPoints.currentBatteryLevel() + "%";

            double chargeLevel = SystemEndPoints.currentBatteryLevel();

            backgroundStatus.Height = (chargeLevel / 100) * 336;
        }
コード例 #8
0
        public void setup()
        {
            bool isCharging = SystemEndPoints.isCharging();

            if (isCharging)
            {
                string chargeString = SystemEndPoints.calculateChargeRateString("in");
                if (chargeString.Contains("calculating"))
                {
                    ChargeStatusDescription.Text = "calculating...";
                }
                else if (chargeString.Contains("fully"))
                {
                    ChargeStatusDescription.Text = "fully charged, you can unplug me";
                }
                else
                {
                    ChargeStatusDescription.Text = "fully charged in " + chargeString;
                }
            }
            else
            {
                string chargeString = SystemEndPoints.getTimeTillPowerOff();
                if (chargeString.Contains("calculating"))
                {
                    ChargeStatusDescription.Text = "calculating...";
                }
                else if (chargeString.Contains("fully"))
                {
                    ChargeStatusDescription.Text = "fully charged, you can unplug me";
                }
                else
                {
                    ChargeStatusDescription.Text = "power off in " + SystemEndPoints.getTimeTillPowerOff();
                }
            }
            hour.Text = SystemEndPoints.currentBatteryLevel() + "%";
        }
コード例 #9
0
ファイル: DomoSmall.xaml.cs プロジェクト: deucks/Battery-Guru
 public void setup()
 {
     hour.Text = SystemEndPoints.currentBatteryLevel() + "%";
 }
コード例 #10
0
 public SimpleWide()
 {
     InitializeComponent();
     hour.Text = SystemEndPoints.currentBatteryLevel().ToString() + "%";
 }