public FriendViewModel(Friend friend, IHandleFriendChanged friendChangedHandler) { m_friend = friend; m_friendChangedHandler = friendChangedHandler; AvailableColors = new ObservableCollection <HairColor>() { new HairColor("Black"), new HairColor("White"), new HairColor("Red"), new HairColor("Brown"), new HairColor("Green"), new HairColor("Pink"), new HairColor("Blue"), new HairColor("Yellow"), }; }
public async Task Initialize(IHandleFriendChanged friendChangedHandler) { try { IsBusy = true; var friendsFetched = await m_friendsService.Get(); foreach (var friend in friendsFetched) { Friends.Add(new FriendViewModel(friend, friendChangedHandler)); } } catch (Exception exception) { //Log it, fix it or show it } finally { IsBusy = false; } }