Beispiel #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;
            }
        }
        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;
            }
        }