internal static WeakPropertyChangedListener CreateIfNecessary(object source, ISourcePropertyChanged sourcePropertyChanged) { INotifyPropertyChanged notifyPropertyChanged = source as INotifyPropertyChanged; if (notifyPropertyChanged == null) { return null; } return new WeakPropertyChangedListener(notifyPropertyChanged, sourcePropertyChanged); }
internal static WeakPropertyChangedListener CreateIfNecessary(object source, ISourcePropertyChanged sourcePropertyChanged) { INotifyPropertyChanged notifyPropertyChanged = source as INotifyPropertyChanged; if (notifyPropertyChanged == null) { return(null); } return(new WeakPropertyChangedListener(notifyPropertyChanged, sourcePropertyChanged)); }
private void PropertyChangedCallback(object sender, PropertyChangedEventArgs args) { if (this.weakclrPropertyListener == null) { return; } ISourcePropertyChanged target = this.weakclrPropertyListener.Target as ISourcePropertyChanged; if (target == null) { this.Disconnect(); return; } target.SourcePropertyChanged(sender, args); }
private WeakPropertyChangedListener(INotifyPropertyChanged notify, ISourcePropertyChanged sourcePropertyChanged) { this.notifyPropertyChanged = notify; notify.PropertyChanged += new PropertyChangedEventHandler(this.PropertyChangedCallback); this.weakclrPropertyListener = new WeakReference(sourcePropertyChanged); }