本文整理汇总了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();
}
示例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);
}
示例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();
}
示例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();
}
示例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();
}