private void CollectionChanged(NotifyCollectionChangedEventArgs e) { //Add if (e.Action == NotifyCollectionChangedAction.Add) { if (e.NewItems != null) { foreach (object item in e.NewItems) { if (item.GetType() == typeof(User)) { User user = (User)item; OnUserAdded?.Invoke(user, new EventArgs()); } } } } //Remove if (e.Action == NotifyCollectionChangedAction.Remove) { if (e.OldItems != null) { foreach (object item in e.OldItems) { if (item.GetType() == typeof(User)) { User user = (User)item; OnUserRemoved?.Invoke(user, new EventArgs()); } } } } //Updates if (e.Action == NotifyCollectionChangedAction.Replace) { if (e.NewItems != null) { foreach (Object item in e.NewItems) { if (item.GetType() == typeof(Output)) { Output output = (Output)item; OnOutputUpdated?.Invoke(this, new EventArgs()); } if (item.GetType() == typeof(User)) { User user = (User)item; OnUserUpdated?.Invoke(user, new EventArgs()); } if (item.GetType() == typeof(PSU)) { PSU psu = (PSU)item; OnPSUUpdated?.Invoke(psu, new EventArgs()); } } } } }
private void RemoveAt(int index) { User user = _userList[index]; OnUserRemoved?.Invoke(user); OnUserListChanged?.Invoke(user); _userList.RemoveAt(index); }
//Close client account and remove user private void RemoveUser() { _clientConnection.Disconnect(); OnUserRemoved?.Invoke(_user, EventArgs.Empty); _isConnected = false; _clientConnection = null; _user = null; }
public void RemoveMember(ulong member) { if (Contains(member)) { _members.Remove(member); OnUserRemoved?.Invoke(ChannelId, member); } }
//Remove NetUser And Take Status String void Remove(NetUser u, string status) { try { if (users.Remove(u)) { UserStatusChanged(false, status, u); OnUserRemoved?.Invoke(u); } } catch (Exception e) { Console.WriteLine("GroupChat|Remove| User: "******" \nError: " + e.Message); } }
public static void SetUserRemovedDelegate(OnUserRemoved delegateOnUserRemoved) { m_delegateOnUserRemoved = delegateOnUserRemoved; }
private void Remove(User user) { OnUserRemoved?.Invoke(user); OnUserListChanged?.Invoke(user); _userList.Remove(user); }
protected void RaiseUserRemoved(UserBase user) { OnUserRemoved?.Invoke(user); }