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()); } } } } }
public static void OutputUpdated(Outputtable output) { OnOutputUpdated?.Invoke(output); }
protected void OutputUpdated() { outputUpdated?.Raise(this, OutputCollection); OnOutputUpdated?.Invoke(); }