コード例 #1
0
        // EventRegistrationToken PropertyChanged.add(PropertyChangedEventHandler value)
        internal EventRegistrationToken add_PropertyChanged(PropertyChangedEventHandler value)
        {
            INotifyPropertyChanged _this = Unsafe.As<INotifyPropertyChanged>(this);
            EventRegistrationTokenTable<PropertyChangedEventHandler> table = s_weakTable.GetOrCreateValue(_this);

            EventRegistrationToken token = table.AddEventHandler(value);
            _this.PropertyChanged += value;

            return token;
        }
コード例 #2
0
ファイル: marshalinghelpers.cs プロジェクト: zhufengGNSS/mono
        internal EventRegistrationToken add_CollectionChanged(NotifyCollectionChangedEventHandler value)
        {
            INotifyCollectionChanged _this = JitHelpers.UnsafeCast <INotifyCollectionChanged>(this);
            EventRegistrationTokenTable <NotifyCollectionChangedEventHandler> table = m_weakTable.GetOrCreateValue(_this);

            EventRegistrationToken token = table.AddEventHandler(value);

            _this.CollectionChanged += value;

            return(token);
        }
コード例 #3
0
        // EventRegistrationToken PropertyChanged.add(EventHandler<object> value)
        private EventRegistrationToken add_CanExecuteChanged(EventHandler<object> value)
        {
            ICommand _this = Unsafe.As<ICommand>(this);
            EventRegistrationTokenTable<EventHandler> table = s_weakTable.GetOrCreateValue(_this);

            EventHandler handler = ICommandAdapterHelpers.CreateWrapperHandler(value);
            EventRegistrationToken token = table.AddEventHandler(handler);
            _this.CanExecuteChanged += handler;

            return token;
        }