Exemple #1
0
 protected override void OnDispose()
 {
     mCallBackFuctions.UserViewModelNetEvent -= this.NetEventResult;
     _User.MSGSync -= OnMsgAddToRepository;
     if (CloseViewEvent != null)
     {
         Delegate[] dels = CloseViewEvent.GetInvocationList();
         foreach (Delegate d in dels)
         {
             object delObj   = d.GetType().GetProperty("Method").GetValue(d, null);
             string funcName = (string)delObj.GetType().GetProperty("Name").GetValue(delObj, null);
             CloseViewEvent -= d as EventHandler <EventArgs>;
         }
     }
     if (MsgViewModelEvent != null)
     {
         Delegate[] dels = MsgViewModelEvent.GetInvocationList();
         foreach (Delegate d in dels)
         {
             object delObj   = d.GetType().GetProperty("Method").GetValue(d, null);
             string funcName = (string)delObj.GetType().GetProperty("Name").GetValue(delObj, null);
             MsgViewModelEvent -= d as EventHandler <UserMsgViewEventArgs>;
         }
     }
 }
        protected override void OnDispose()
        {
            foreach (UserViewModel custVM in this.AllUsers)
            {
                custVM.Dispose();
            }

            this.AllUsers.Clear();
            this.AllUsers.CollectionChanged -= this.OnCollectionChanged;

            _UserRepository.UserAdded -= this.OnUserAddedToRepository;
            _UserRepository.UserDel   -= this.OnUserDelToRepository;

            if (MsgViewModelEvent != null)
            {
                Delegate[] dels = MsgViewModelEvent.GetInvocationList();
                foreach (Delegate d in dels)
                {
                    object delObj   = d.GetType().GetProperty("Method").GetValue(d, null);
                    string funcName = (string)delObj.GetType().GetProperty("Name").GetValue(delObj, null);
                    MsgViewModelEvent -= d as EventHandler <UserMsgViewEventArgs>;
                }
            }
        }