/// <summary> /// TODO: This method should not be exposed as public method -> find another way to connect friends by accepting invitations /// </summary> /// <param name="user"></param> public void AddFriend(UserInfo user) { if (!Friends.Any(f => f.UserId == user.UserId)) { _friends.Add(user); } }
private IEnumerable <User> GetHaveNotFollowedUsers() { foreach (var user in Followers) { if (!Friends.Any(e => e.Id == user.Id)) { yield return(user); } } }
public async Task GetFriends() { IEnumerable <Friend> friends = await friendsService.Get(); // очищаем список //Friends.Clear(); while (Friends.Any()) { Friends.RemoveAt(Friends.Count - 1); } // добавляем загруженные данные foreach (Friend f in friends) { Friends.Add(f); } }
private async Task SearchPerson(string query) { await semaphoreSlim.WaitAsync(); _lastQuery = query; if (query.Length > 2) { EmeptyViewText = "No match found"; } else { EmeptyViewText = "Minimum 3 Characters..."; } try { if (!string.IsNullOrEmpty(query) && query.Length > 2) { var SearchPersonResponse = await _dbHelper.SearchPerson(new SearchPersonRequest { Query = query }); var queryFriends = SearchPersonResponse.Results.Select(o => (Friend)o); UpdateFriendsResults(queryFriends); if (!Friends.Any()) { Friends.Clear(); } } else { Friends.Clear(); } OnPropertyChanged(nameof(EmeptyViewText)); } finally { semaphoreSlim.Release(); } }
public async void NavigatedTo(FriendsPageNavArgs args) { if (args.Equals(_lastArgs)) { return; } if (_friendsCache.ContainsKey(args.TargetUser.Name.ToLower())) { Friends = new ObservableCollection <MalFriend>(_friendsCache[args.TargetUser.Name.ToLower()]); } else { Loading = true; Friends = new ObservableCollection <MalFriend>(); var result = (await new FriendsQuery(args.TargetUser.Name).GetFriends()) ?? new List <MalFriend>(); _friendsCache[args.TargetUser.Name.ToLower()] = result; Friends = new ObservableCollection <MalFriend>(result); Loading = false; } if (args.TargetUser.Name.Equals(Credentials.UserName, StringComparison.CurrentCultureIgnoreCase)) { ShowPending = true; if (_requests == null) { RefreshPendingCommand.Execute(null); } } else { ShowPending = false; } FriendsEmptyNoticeVisibility = !Friends.Any(); _lastArgs = args; }
public async Task GetFriends() { if (initialized == true) { return; } IsBusy = true; IEnumerable <Friend> friends = await friendsService.Get(); // очищаем список Friends.Clear(); while (Friends.Any()) { Friends.RemoveAt(Friends.Count - 1); } // добавляем загруженные данные foreach (Friend f in friends) { Friends.Add(f); } IsBusy = false; initialized = true; }
public bool AddFriend(string friendName, Serial friendSerial) { if (Friends.Any(f => f.Serial == friendSerial) == false) { Friend newFriend = new Friend { Name = friendName, Serial = friendSerial }; Friends.Add(newFriend); if (_friendGroups.SelectedItem == this) { RedrawList(this); } World.Player?.SendMessage(MsgLevel.Friend, $"Added '{friendName}' to '{GroupName}'"); return(true); } return(false); }
public bool Lonely() => As.Expression(() => !Friends.Any());
public bool IsFriend(string email) { return(Friends.Any(friend => friend.ToLower().Equals(email.ToLower()))); }