Ejemplo n.º 1
0
        private async Task DeleteHistory()
        {
            const string filtered = "filtered";
            const string complete = "complete";
            var          message  = $"Do you realy want to delete the {(UndoFilterCommand.IsEnabled ? filtered : complete)} History?";
            var          delete   = await _uiService.DisplayAlert(message);

            if (delete)
            {
                await _uiService.ShowActivityPopup("deleting ...");

                var itemsToDelete = UndoFilterCommand.IsEnabled ? await _repository.FindAll <SyncLog>(_ => _.StartDate <= _startDate && _.EndDate >= _endDate) : await _repository.GetAll <SyncLog>();

                if (itemsToDelete.Any())
                {
                    _repository.DeleteRange(itemsToDelete);
                    _syncLogsInternal.Clear();
                }
                if (itemsToDelete.Any() || !itemsToDelete.Any())
                {
                    await _uiService.RemoveActivityPopup();
                }
            }
        }
Ejemplo n.º 2
0
        private async void SendBatteryLifeRequest(object state)
        {
            var batteryLife = await aboavobrRestEndpoint.GetBatteryLifeAsync();

            if (batteryLife > 0)
            {
                BatteryLifeInPercent = $"{batteryLife}%";

                if (!wasAlreadyNotified && batteryLife < BatteryHealthyStateThreshold)
                {
                    wasAlreadyNotified = true;
                    uiService.DisplayAlert("Battery Low", "Battery is low, consider chargin it up soon", "Ok");
                }
            }
            else
            {
                BatteryLifeInPercent = UknownBatteryLife;
            }
        }