private List <FriendDTO> GetResponsibles(IEnumerable <FriendDTO> childs) { var responsible = new List <FriendDTO>(); foreach (var email in childs) { var friend = Friends.First(x => x.Email.Equals(email.Email)); responsible.Add(friend); Friends.Remove(friend); } return(responsible); }
private List <FriendDTO> GetWinners(IEnumerable <FriendDTO> childs) { var winner = new List <FriendDTO>(); foreach (var child in childs) { var friendName = Friends.First(x => x.Email.Equals(child.Email)); winner.Add(new FriendDTO { Name = string.Concat(friendName.Name, ", ", child.Name), Description = friendName.Description }); Friends.Remove(friendName); } return(winner); }
private bool ValidationRepeatDrawn() { var repeat = false; var friends = _repositoriesFriend.GetAll(); foreach (var friend in friends) { var friendRepeat = Friends.First(x => x.Email.Equals(friend.Email)); if (friend.Email.Equals(friendRepeat.Email) && friend.Name.Equals(friendRepeat.Name)) { Names.Add(friendRepeat.Name); repeat = true; } } return(repeat); }
public SendViewModel() { chatService = ServiceLocator.Current.GetInstance <IChatService>(); parentViewModel = ServiceLocator.Current.GetInstance <CameraViewModel>(); parentViewModel.PropertyChanged += parentViewModel_PropertyChanged; ResetImageSource(); SendPhoto = new RelayCommand(async() => { PhotoRecord p = new PhotoRecord(); // If they didn't explicitly toggle the list picker, assume // they want the first contact in the list. if (SelectedFriend != null) { p.RecepientUserId = SelectedFriend.UserId; } else { p.RecepientUserId = Friends.First().UserId; } p.SenderUserId = App.CurrentUser.UserId; p.SenderName = App.CurrentUser.Name; await chatService.CreatePhotoRecordAsync(p); System.Net.Http.HttpResponseMessage m = await chatService.UploadPhotoAsync(p.Uri, p.UploadKey, parentViewModel.Image); App.RootFrame.Navigate(new Uri("/View/PhotosPage.xaml", UriKind.RelativeOrAbsolute)); }); RefreshCommand = new RelayCommand(async() => { Friends = await chatService.ReadFriendsAsync(App.CurrentUser.UserId); }); }
private async void LoadDataAsync() { IsLoading = true; try { // var friends = _dataProvideder.LoadFriend(); var task = Task.Run(() => _dataProvideder.LoadFriend()); IEnumerable <Friend> friends = await task; foreach (var friend in friends) { Friends.Add(friend); } } finally { IsLoading = false; } SelectedFriend = Friends.Count > 0 ? Friends.First() : null; }
/// <summary> /// Removes a friend from game manager's <see cref="Friends"/> list. /// </summary> /// <param name="friend">username of the friend to remove</param> public void RemoveFriend(string friend) { Friends.Remove(Friends.First(f => f.Login == friend)); }