本文整理汇总了C#中Observable.OnPropertyChanged方法的典型用法代码示例。如果您正苦于以下问题:C# Observable.OnPropertyChanged方法的具体用法?C# Observable.OnPropertyChanged怎么用?C# Observable.OnPropertyChanged使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Observable
的用法示例。
在下文中一共展示了Observable.OnPropertyChanged方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: can_get_the_number_of_times_a_property_has_changed
public void can_get_the_number_of_times_a_property_has_changed()
{
var observable = new Observable();
var observer = new PropertyChangeObserver<Observable>(observable);
Assert.Equal(0, observer.GetChangeCount("Property"));
Assert.Equal(0, observer.GetChangeCount(x => x.Property));
observable.OnPropertyChanged("Property");
Assert.Equal(1, observer.GetChangeCount("Property"));
Assert.Equal(1, observer.GetChangeCount(x => x.Property));
observable.OnPropertyChanged("Property");
Assert.Equal(2, observer.GetChangeCount("Property"));
Assert.Equal(2, observer.GetChangeCount(x => x.Property));
}
示例2: can_clear_the_observed_changed
public void can_clear_the_observed_changed()
{
var observable = new Observable();
var observer = new PropertyChangeObserver<Observable>(observable);
observable.OnPropertyChanged("Property");
observer.ClearChanges();
Assert.False(observer.HasChanged(x => x.Property));
}
示例3: can_determine_if_a_property_has_changed
public void can_determine_if_a_property_has_changed()
{
var observable = new Observable();
var observer = new PropertyChangeObserver<Observable>(observable);
Assert.False(observer.HasChanged("Property"));
Assert.False(observer.HasChanged(x => x.Property));
observable.OnPropertyChanged("Property");
Assert.True(observer.HasChanged("Property"));
Assert.True(observer.HasChanged(x => x.Property));
}