private void InitializeBatteryInformation() { // First time ? Need to refresh the position if (_firstInitialise) { BatteryBackgroundImage.Hidden = true; LastRefreshBatteryLabel.Text = Application.LocalizedString("UpdatePosition"); RefreshBatteryButton.Enabled = false; } else { RefreshBatteryButton.Enabled = true; // Make the indicator loading if (_seekiosSelected.IsRefreshingBattery) { BatteryIndicator.Hidden = false; BatteryIndicator.StartAnimating(); RefreshBatteryButton.Enabled = false; } // Display the value if (_seekiosSelected.DateLastCommunication.HasValue) { LastRefreshBatteryLabel.Text = string.Format(Application.LocalizedString("BatteryLevel") , _seekiosSelected.BatteryLife , _seekiosSelected.DateLastCommunication.Value.FormatDateTimeFromNow(false)); BatteryBackgroundImage.Hidden = false; } // No information about the battery else { BatteryBackgroundImage.Hidden = true; LastRefreshBatteryLabel.Text = Application.LocalizedString("NoInformation"); } } }
private async void RefreshBatteryButton_TouchUpInside(object sender, EventArgs e) { if (await App.Locator.DetailSeekios.RequestBatteryLevel()) { // Update UI with a loader to show the battery is refreshing BatteryIndicator.Hidden = false; BatteryIndicator.StartAnimating(); RefreshBatteryButton.Enabled = false; _seekiosSelected.IsRefreshingBattery = true; } }