, -, , , , , .
, UI, , .
., (, INotifyPropertyChanged, ), , , , , , , UI, .
:. , , - - "STFU", true, , UI. "OnRaiseMyEvent (...)" STFU - true, STFU, , .
# 2:. , , : ISynchronizeInvoke -. - , - :
public class MyObject {
private ISynchronizeInvoke _Invoker;
public MyObject(ISynchronizeInvoke invoker) {
_Invoker = invoker;
}
private void OnPropertyChanged(string propertyName) {
PropertyChangedEventHandler handlers = this.PropertyChanged;
if (handlers != null) {
if (_Invoker.InvokeRequired) {
_Invoker.Invoke(handlers, new PropertyChangedEventArgs(propertyName));
} else {
handlers(new PropertyChangedEventArgs(propertyName);
}
}
}