/// <summary> /// checks if member exists already or not /// if none add it /// </summary> /// <param name="obj"></param> private void OnReceiveMessageAction(Member obj) { if (members.Contains(obj)) { MessageBox.Show("Member Already Exist"); } else { members.Add(obj); this.RaisePropertyChanged(() => this.MemberList); } Messenger.Default.Unregister <Member>(this, OnReceiveMessageAction); addMemWindow.Close(); }
/// <summary> /// opens the addMemberViewModel to add a new member /// </summary> public void AddMember() { addMemWindow = new AddMemberWindow(); addMemWindow.DataContext = new AddMemberViewModel(new System.Action(() => addMemWindow.Close())); addMemWindow.Show(); Messenger.Default.Register <Member>(this, OnReceiveMessageAction); }