当前位置: 首页>>代码示例>>C#>>正文


C# BindingSourceModel.OnPropertyChanged方法代码示例

本文整理汇总了C#中MugenMvvmToolkit.Test.TestModels.BindingSourceModel.OnPropertyChanged方法的典型用法代码示例。如果您正苦于以下问题:C# BindingSourceModel.OnPropertyChanged方法的具体用法?C# BindingSourceModel.OnPropertyChanged怎么用?C# BindingSourceModel.OnPropertyChanged使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MugenMvvmToolkit.Test.TestModels.BindingSourceModel的用法示例。


在下文中一共展示了BindingSourceModel.OnPropertyChanged方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: WeakEventManagerShouldSubscribeAndUnsubscribePropertyChangedEventSeveralSources

        public void WeakEventManagerShouldSubscribeAndUnsubscribePropertyChangedEventSeveralSources()
        {
            const int count = 100;
            const string propertyName = "test";

            var model = new BindingSourceModel();
            var listeners = new List<EventListenerMock>();
            var invokedItems = new List<EventListenerMock>();
            IWeakEventManager weakEventManager = CreateWeakEventManager();

            for (int i = 0; i < count; i++)
            {
                var listenerMock = new EventListenerMock();
                var disposable = weakEventManager.Subscribe(model, propertyName, listenerMock);
                listeners.Add(listenerMock);
                listenerMock.Handle = (o, o1) =>
                {
                    invokedItems.Add(listenerMock);
                    disposable.Dispose();
                };
            }
            model.OnPropertyChanged(propertyName + "1");
            model.OnPropertyChanged(propertyName);
            model.OnPropertyChanged(propertyName);

            invokedItems.Count.ShouldEqual(count);
            foreach (var listener in listeners)
                invokedItems.Contains(listener).ShouldBeTrue();
        }
开发者ID:MuffPotter,项目名称:MugenMvvmToolkit,代码行数:29,代码来源:WeakEventManagerTest.cs

示例2: WeakEventManagerShouldSubscribeAndUnsubscribePropertyChangedEvent

        public void WeakEventManagerShouldSubscribeAndUnsubscribePropertyChangedEvent()
        {
            const string propertyName = "test";
            int invokedCount = 0;
            var model = new BindingSourceModel();
            var listenerMock = new EventListenerMock();
            IWeakEventManager weakEventManager = CreateWeakEventManager();
            var disposable = weakEventManager.Subscribe(model, propertyName, listenerMock);

            listenerMock.Handle = (o, o1) => invokedCount++;
            invokedCount.ShouldEqual(0);

            model.OnPropertyChanged(propertyName + "1");
            invokedCount.ShouldEqual(0);
            model.OnPropertyChanged(propertyName);
            invokedCount.ShouldEqual(1);

            disposable.Dispose();

            model.OnPropertyChanged(propertyName);
            invokedCount.ShouldEqual(1);
        }
开发者ID:MuffPotter,项目名称:MugenMvvmToolkit,代码行数:22,代码来源:WeakEventManagerTest.cs

示例3: RaiseCanExecuteChangedShouldBeInvokedOnPropertyChanged

 public void RaiseCanExecuteChangedShouldBeInvokedOnPropertyChanged()
 {
     var notifier = new BindingSourceModel();
     bool isInvoked = false;
     var relayCommand = CreateCommand(NodoAction, o => true);
     relayCommand.CanExecuteMode = ExecutionMode.None;
     relayCommand.CanExecuteChanged += (sender, args) =>
     {
         isInvoked = true;
     };
     relayCommand.AddNotifier(notifier);
     notifier.OnPropertyChanged("Test", ExecutionMode.None);
     isInvoked.ShouldBeTrue();
 }
开发者ID:dbeattie71,项目名称:MugenMvvmToolkit,代码行数:14,代码来源:RelayCommandTest.cs

示例4: WeakEventManagerShouldRemoveWeakListenersPropertyChanged

        public void WeakEventManagerShouldRemoveWeakListenersPropertyChanged()
        {
            const int count = 100;
            const string propertyName = "test";

            var model = new BindingSourceModel();
            var listeners = new List<WeakReference>();
            IWeakEventManager weakEventManager = CreateWeakEventManager();

            for (int i = 0; i < count; i++)
            {
                var listenerMock = new EventListenerMock();
                weakEventManager.Subscribe(model, propertyName, listenerMock);
                listeners.Add(new WeakReference(listenerMock));
                listenerMock.Handle = (o, o1) => { };
            }
            GC.Collect();
            GC.WaitForPendingFinalizers();
            GC.Collect();

            model.OnPropertyChanged(propertyName + "1");
            model.OnPropertyChanged(propertyName);
            model.OnPropertyChanged(propertyName);

            listeners.All(reference => reference.Target == null).ShouldBeTrue();
        }
开发者ID:MuffPotter,项目名称:MugenMvvmToolkit,代码行数:26,代码来源:WeakEventManagerTest.cs

示例5: ObserverShouldRaiseValueChangedEventWhenPropertyChangedDoubleIndexer

        public void ObserverShouldRaiseValueChangedEventWhenPropertyChangedDoubleIndexer()
        {
            bool isInvoked = false;
            var model = new BindingSourceModel();
            var propertyName = GetMemberPath(model, sourceModel => sourceModel["test", 0]);
            var observer = CreateObserver(model, propertyName, false);
            observer.ValueChanged += (sender, args) => isInvoked = true;

            isInvoked = false;
            model["test", 0] = "test";
            isInvoked.ShouldBeFalse();
            model.OnPropertyChanged(ReflectionExtensions.IndexerName);
            isInvoked.ShouldBeTrue();
            isInvoked = false;

            model["test", 0] = "test1";
            isInvoked.ShouldBeFalse();
            model.OnPropertyChanged("Item[test,0]");
            isInvoked.ShouldBeTrue();
        }
开发者ID:sami1971,项目名称:MugenMvvmToolkit,代码行数:20,代码来源:ObserverTest.cs


注:本文中的MugenMvvmToolkit.Test.TestModels.BindingSourceModel.OnPropertyChanged方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。