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"); }
public void setup() { bool isCharging = SystemEndPoints.isCharging(); ChargeStatus.Text = SystemEndPoints.currentBatteryLevel() + "%"; double chargeLevel = SystemEndPoints.currentBatteryLevel(); backgroundStatus.Width = (chargeLevel / 100) * 241; }
public void giveBatteryFullToast() { if (SystemEndPoints.currentBatteryLevel() > 99 && SystemEndPoints.isCharging()) { ShellToast toast = new ShellToast(); toast.Title = "BatteryGuru"; toast.Content = "You can unplug me."; toast.Show(); } }
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; }
public void checkLastUpdate() { if (SystemEndPoints.minutesTillLastUpdate() > 5) { MessageBoxResult m = MessageBox.Show("The app is not updating properly to log battery data." + Environment.NewLine + Environment.NewLine + "This may be the result of other apps running in the background that are not needed." + Environment.NewLine + Environment.NewLine + "Would you like to see tips on how to fix this?", "BatteryGuru not updating?", MessageBoxButton.OKCancel); if (m == MessageBoxResult.OK) { NavigationService.Navigate(new Uri("/NotUpdating.xaml", UriKind.Relative)); } } }
public void updateUI() { int currentStatus = SystemEndPoints.currentBatteryLevel(); System.Windows.Deployment.Current.Dispatcher.BeginInvoke(() => { ChargingStatusBar.Value = currentStatus; ChargeStatus.Text = currentStatus + "%"; }); //updateDetailedListUI(); }
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(); } }
private void GraphSort_SelectionChanged(object sender, SelectionChangedEventArgs e) { int executeOnce = 0; try { ListPickerItem lpi = (sender as ListPicker).SelectedItem as ListPickerItem; GraphType = lpi.Content.ToString(); sortText.Text = GraphType; if (executeOnce == 0) { graphModel.setType(GraphType); executeOnce++; Debug.WriteLine(GraphType.ToString()); if (GraphType == "last hour") { graphModel.GenerateLastHour(); } else if (GraphType == "last 24 hours") { graphModel.GenerateDaily(); } else if (GraphType == "last 7 days") { graphModel.GenerateWeekly(); } else if (GraphType == "last charge") { graphModel.GenerateLastCharge(); sortText.Text += " (" + timeSinceLastChargeInput.Text + ")"; } else if (GraphType == "last 100% charge") { graphModel.GenerateAllTime(); sortText.Text += " (" + SystemEndPoints.timeSinceLastHundred() + ")"; } areachart.DataContext = graphModel; } } catch { //selection failed } //updateDetailedListUI(); }
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; }
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() + "%"; }
public void updateStates() { updateUI(); bool isCharging = SystemEndPoints.isCharging(); if (isCharging) { System.Windows.Deployment.Current.Dispatcher.BeginInvoke(() => { DischarginRateTitle.Text = "CHARGING RATE"; PowerOffTitle.Text = "FULL CHARGE IN"; PowerOffAtTitle.Text = "FULL CHARGE AT"; DischargeRateInput.Text = SystemEndPoints.calculateChargeRateString("rate"); powerOffInInput.Text = SystemEndPoints.calculateChargeRateString("in"); powerOffAtInput.Text = SystemEndPoints.calculateChargeRateString("at"); timeSinceLastChargeInput.Text = "currently charging..."; }); //Debug.WriteLine(SystemEndPoints.calculateChargeRate()); } else { System.Windows.Deployment.Current.Dispatcher.BeginInvoke(() => { DischarginRateTitle.Text = "DISCHARGING RATE"; PowerOffTitle.Text = "POWER OFF"; PowerOffAtTitle.Text = "POWER OFF AT"; timeSinceLastChargeInput.Text = SystemEndPoints.timeSinceLastCharge(); DischargeRateInput.Text = SystemEndPoints.getTimeRatio(); powerOffAtInput.Text = SystemEndPoints.getPowerOffTime(); powerOffInInput.Text = SystemEndPoints.getTimeTillPowerOff(); }); } }
public void preSetup() { //Enable app to run in the background detailedList PhoneApplicationService.Current.ApplicationIdleDetectionMode = IdleDetectionMode.Disabled; //Start the dispatch timer DispatcherTimer newTimer = new DispatcherTimer(); // timer interval specified as 1 second newTimer.Interval = TimeSpan.FromSeconds(30); // Sub-routine OnTimerTick will be called at every 1 second newTimer.Tick += OnTimerTick; // starting the timer newTimer.Start(); //set grapgh model areachart.DataContext = graphModel; //if true, internet is accessible. Debug.WriteLine(" internet access " + SystemEndPoints.isInternetOn().ToString()); Debug.WriteLine(" airplane access " + SystemEndPoints.isAirplaneOn().ToString()); Debug.WriteLine(" data access " + SystemEndPoints.isOverDataLimit().ToString()); Debug.WriteLine(" number of " + SystemEndPoints.countLastChargeFactors("all").ToString()); if (appSettings.getSettingsBool(appSettings.AppRated)) { rateMe.Text = "rate me"; } if (appSettings.getSettingsBool(appSettings.ProEnabled)) { goProButton.Visibility = System.Windows.Visibility.Collapsed; } }
public void setup() { hour.Text = SystemEndPoints.currentBatteryLevel() + "%"; }
public SimpleWide() { InitializeComponent(); hour.Text = SystemEndPoints.currentBatteryLevel().ToString() + "%"; }