Skip to content

Commit

Permalink
fix can execute changed
Browse files Browse the repository at this point in the history
  • Loading branch information
mes51 committed Nov 4, 2018
1 parent 7e4ced8 commit 4fac353
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions Intervallo/Command/CommandBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,21 @@ public CommandBase(MainWindow window)
Window = window;
}

public event EventHandler CanExecuteChanged;
event EventHandler InternalCanExecuteChanged;

public event EventHandler CanExecuteChanged
{
add
{
CommandManager.RequerySuggested += value;
InternalCanExecuteChanged += value;
}
remove
{
CommandManager.RequerySuggested -= value;
InternalCanExecuteChanged -= value;
}
}

protected MainWindow Window { get; }

Expand All @@ -29,7 +43,7 @@ public virtual bool CanExecute(object parameter)
// XXX: change access level to protected
public void OnCanExecuteChanged()
{
CanExecuteChanged?.Invoke(this, EventArgs.Empty);
InternalCanExecuteChanged?.Invoke(this, EventArgs.Empty);
}
}
}

0 comments on commit 4fac353

Please sign in to comment.