コード例 #1
0
        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;
            }
        }
コード例 #2
0
        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;
            }
        }
コード例 #3
0
        private void SetReminders()
        {
            Reminders.Clear();

            ObservableCollection <Reminder> reminders = GetAll();

            if (reminders != null)
            {
                foreach (Reminder reminder in reminders)
                {
                    Reminders.Add(reminder);
                }
            }
        }
コード例 #4
0
 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);
     }
 }