public override void Dispose() { this.sourceRootNode.Unobserve(); this.sourceRootNode = null; this.canExecuteTargetProperty = null; this.canExecuteChangedWeakEventHandler.Unsubscribe(); this.canExecuteChangedWeakEventHandler = null; base.Dispose(); }
protected void WhenCommandChanged() { if (this.canExecuteTargetProperty != null) { if (this.canExecuteChangedWeakEventHandler != null) { this.canExecuteChangedWeakEventHandler.Unsubscribe(); this.canExecuteChangedWeakEventHandler = null; } var command = this.GetCommand(); this.canExecuteChangedWeakEventHandler = new CanExecuteChangedWeakEventHandler(command, this.OnCanExecuteChanged); this.OnCanExecuteChanged(command, EventArgs.Empty); } }