/// <summary> /// The load silly people. /// </summary> /// <returns> /// The <see cref="Task"/>. /// </returns> private async Task <ObservableCollection <SillyDudeVmo> > LoadSillyPeopleAsync() { SillyOfTheDay = new SillyDudeVmo(await _sillyDudeService.GetRandomSilly(), GoToSillyDudeCommand); RaisePropertyChanged(nameof(SillyOfTheDay)); return(new ObservableCollection <SillyDudeVmo>( (await _sillyDudeService.GetSillyPeople()) .Select(dude => new SillyDudeVmo(dude, GoToSillyDudeCommand)))); }
/// <param name="sillyDude">The silly dude.</param> /// <returns>The <see cref="Task" />.</returns> /// <exception cref="System.InvalidOperationException">The knigths demand...... A SACRIFICE!</exception> private async Task GoToSillyDudeAsync(SillyDudeVmo sillyDude) { if (sillyDude.Id == 2) { throw new InvalidOperationException("The knigths demand...... A SACRIFICE!"); } await NavigationService.NavigateToAsync <SillyDudeVm>(sillyDude.Id); }
/// <summary> /// The load silly people. /// </summary> /// <returns> /// The <see cref="Task"/>. /// </returns> private async Task <ObservableCollection <SillyDudeVmo> > LoadSillyPeopleAsync() { SillyOfTheDay = new SillyDudeVmo(await _sillyDudeService.GetRandomSilly(), GoToSillyDudeCommand); RaisePropertyChanged(nameof(SillyOfTheDay)); var result = new ObservableCollection <SillyDudeVmo>( (await _sillyDudeService.GetSillyPeople()).Select( dude => new SillyDudeVmo(dude, GoToSillyDudeCommand))); // Test the drag and drop lock // result.First().Lock(); // result.Last().Lock(); return(result); }