コード例 #1
0
        // void PropertyChanged.remove(EventRegistrationToken token)
        private void remove_CanExecuteChanged(EventRegistrationToken token)
        {
            ICommand _this = Unsafe.As <ICommand>(this);
            EventRegistrationTokenTable <EventHandler> table = s_weakTable.GetOrCreateValue(_this);

            if (table.RemoveEventHandler(token, out EventHandler handler))
            {
                _this.CanExecuteChanged -= handler;
            }
        }
コード例 #2
0
        // void PropertyChanged.remove(EventRegistrationToken token)
        internal void remove_PropertyChanged(EventRegistrationToken token)
        {
            INotifyPropertyChanged _this = Unsafe.As <INotifyPropertyChanged>(this);
            EventRegistrationTokenTable <PropertyChangedEventHandler> table = s_weakTable.GetOrCreateValue(_this);

            if (table.RemoveEventHandler(token, out PropertyChangedEventHandler handler))
            {
                _this.PropertyChanged -= handler;
            }
        }