コード例 #1
0
        public void TabSelectedChanged(int index)
        {
            if (TabIndex != index)
            {
                _searchtext = null;
                RaisePropertyChanged("SearchText");
            }

            TabIndex = index;

            if (!IsLoading)
            {
                if (AllReminders != null && AllReminders.Any())
                {
                    if (index == 0) // show only active reminders
                    {
                        Reminders = new ObservableCollection <RemindersModel>(AllReminders.Where((arg) => !arg.Reminder.DoneAt.HasValue));
                    }
                    else // Show terminated reminders
                    {
                        Reminders = new ObservableCollection <RemindersModel>(AllReminders.Where((arg) => arg.Reminder.DoneAt.HasValue));
                    }
                }
            }

            if (Reminders != null)
            {
                IsEmpty = !Reminders.Any();
            }
            else
            {
                IsEmpty = true;
            }
        }
コード例 #2
0
 //NOTE: Reminder ID is discarded and re-set here
 public void AddReminder(Reminder reminder)
 {
     reminder.ReminderNumber = Reminders.Any() ? Reminders.Max(x => x.ReminderNumber) + 1 : 1;
     Reminders.Add(reminder);
     Database.Store(reminder, Reminder.DocumentName(reminder.GuildId, reminder.ReminderNumber));
 }