コード例 #1
0
        async Task ExecuteLoadReminderListsCommand()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            try
            {
                ReminderLists.Clear();
                var lists = await ReminderListDataStore.GetModelsAsync(true);

                foreach (var list in lists)
                {
                    var reminders = await ReminderDataStore.GetModelsAsync(false, new Dictionary <Constants.Parameter, object>() { { Constants.Parameter.ReminderListId, list.Id } });

                    list.DetailString = string.Format("{0} todo of {1}", reminders.Where(r => r.Completed == false).ToList().Count(), reminders.Count());
                    ReminderLists.Add(list);
                }
            }
            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
        async Task UpdateReminder(Reminder reminder)
        {
            await ReminderDataStore.UpdateModelAsync(reminder);

            await ExecuteLoadRemindersCommand();
        }
コード例 #4
0
 async Task DeleteReminder(Reminder reminder)
 {
     Reminders.Remove(reminder);
     await ReminderDataStore.DeleteModelAsync(reminder);
 }
コード例 #5
0
 async Task AddReminder(Reminder reminder)
 {
     Reminders.Insert(0, reminder);
     await ReminderDataStore.AddModelAsync(reminder);
 }