public async Task ExecuteLoadItemsCommand() { if (IsBusy) { return; } IsBusy = true; try { Reminders.Clear(); if (MongoRepo.LoggedUser != null) { var pills = await MongoRepo.GetAllRemindersAsync(MongoRepo.LoggedUser.Username); foreach (var pill in pills) { Reminders.Add(pill); } } else { await Application.Current.MainPage.DisplayAlert("Reminders", "You should login to see reminders!", "OK"); } } catch (Exception ex) { Debug.WriteLine(ex); } finally { IsBusy = false; } }
async Task ExecuteLoadRemindersCommand() { if (IsBusy) { return; } IsBusy = true; try { Reminders.Clear(); var parameters = new Dictionary <Constants.Parameter, object>(); parameters[Constants.Parameter.ReminderListId] = ReminderList.Id; var reminders = await ReminderDataStore.GetModelsAsync(true, parameters); reminders = reminders.OrderBy(r => r.Completed).ThenByDescending(r => r.DueDate); foreach (var reminder in reminders) { Reminders.Add(reminder); } } catch (Exception ex) { Debug.WriteLine(ex); } finally { IsBusy = false; } }
private void SetReminders() { Reminders.Clear(); ObservableCollection <Reminder> reminders = GetAll(); if (reminders != null) { foreach (Reminder reminder in reminders) { Reminders.Add(reminder); } } }
private void FetchData() { try { ReminderModel model = new ReminderModel(); DataTable datas = DataManager.Instance.SelectTables(model); Reminders.Clear(); foreach (DataRow data in datas.Rows) { model.FetchData(data); AddToReminders(model); } } catch (Exception e) { LogWriter.Instance.Error(e); } }