private static IEnumerable <ReminderList> ListReminder(int customerNr, ReminderList reminder, List <ReminderList> booksDue) { return(booksDue.Where(t => reminder.Book .Any(r => r.BookID == t.CustomerNr) )); }
async Task DeleteList(ReminderList list) { ReminderLists.Remove(list); await ReminderListDataStore.DeleteModelAsync(list); //todo: delete all reminders on this list }
void BindUI() { btnSaveUser.TouchUpInside += (sender, e) => { var list = new ReminderList { Title = txtTitle.Text, Color = SelectedColor, CreatedDate = DateTime.Now }; ViewModel.AddReminderListCommand.Execute(list); this.DismissModalViewController(true); }; btnCancel.TouchUpInside += (sender, e) => { this.DismissModalViewController(true); }; btnSelectColor.TouchUpInside += (sender, e) => { var picker = new UIColorPickerViewController(); picker.Delegate = new CreateReminderListViewColorPickerDelegate(this); PresentModalViewController(picker, true); }; }
public ReminderListViewModel(ReminderList list = null) { if (list != null) { ReminderList = list; } Title = "Reminder Lists"; Reminders = new ObservableCollection <Reminder>(); LoadReminderListCommand = new Command(async() => await ExecuteLoadRemindersCommand()); AddReminderCommand = new Command <Reminder>(async(Reminder reminder) => await AddReminder(reminder)); DeleteReminderCommand = new Command <Reminder>(async(Reminder reminder) => await DeleteReminder(reminder)); UpdateReminderCommand = new Command <Reminder>(async(Reminder reminder) => await UpdateReminder(reminder)); }
static void Zadatak6() { DarkTheme darkTheme = new DarkTheme(); LightTheme lightTheme = new LightTheme(); ReminderList list1 = new ReminderList("buy more milk plz", darkTheme); list1.AddToList("mihael"); list1.AddToList("bilo ko drugi"); list1.Show(); ReminderList list2 = new ReminderList("get work done", lightTheme); list2.AddToList("mihael"); list2.AddToList("somebodyelse"); list2.Show(); }
public void TestViewModelCommands() { ViewModel.ReminderLists = new ObservableCollection <ReminderList>(); var list = new ReminderList() { Id = 100, Title = "Test Title 1" }; //Add ViewModel.AddReminderListCommand.Execute(list); Assert.True(ViewModel.ReminderLists.Count == 1, "There was an error in the AddReminderListCommand"); //Update list.Title = "Test Title 2"; ViewModel.UpdateReminderCommand.Execute(ViewModel.ReminderLists.LastOrDefault()); Assert.True(ViewModel.ReminderLists.FirstOrDefault().Title == "Test Title 2", "There was an error in the UpdateReminderCommand"); //Delete ViewModel.DeleteReminderListCommand.Execute(ViewModel.ReminderLists.LastOrDefault()); Assert.True(ViewModel.ReminderLists.Count == 0, "There was an error in the DeleteReminderListCommand"); }
async Task UpdateReminder(ReminderList list) { await ReminderListDataStore.UpdateModelAsync(list); await ExecuteLoadReminderListsCommand(); }
async Task AddList(ReminderList list) { ReminderLists.Insert(0, list); await ReminderListDataStore.AddModelAsync(list); }