private void InitializeCommands() { PreviousMonthCommand = new DelegateCommand <object>(_ => { if (CancelDataIsDirty()) { return; } SelectedDate = SelectedDate.FirstDayOfPreviousMonth(); }, x => !IsBusy); NextMonthCommand = new DelegateCommand <object>(_ => { if (CancelDataIsDirty()) { return; } SelectedDate = SelectedDate.FirstDayOfNextMonth(); }, x => !IsBusy); CurrentMonthCommand = new DelegateCommand <object>(_ => { if (CancelDataIsDirty()) { return; } SelectedDate = DateTime.Now.FirstDayOfMonth(); }, x => !IsBusy); DeleteProjectCommand = new DelegateCommand <object>(DeleteProjectExecute); SaveCommand = new DelegateCommand <object>(_ => _saveForecastCommandHandler.Execute(this), _ => _saveForecastCommandHandler.CanExecute(this)); ResetCommand = new DelegateCommand <object>(_ => _resetForecastCommandHandler.Execute(this), _ => _resetForecastCommandHandler.CanExecute(this)); CopyPreviousMonth = new DelegateCommand <object>(_ => { if (!_copyPreviousMonthCommandHandler.ShouldContinue(this)) { return; } IsBusy = true; _copyPreviousMonthCommandHandler.Execute(this); IsBusy = false; RaiseCanExecuteActions(); }, _ => _copyPreviousMonthCommandHandler.CanExecute(this)); }
private void InitializeCommands() { NextMonthCommand = new DelegateCommand <object>(_ => { SelectedDate = SelectedDate.FirstDayOfNextMonth(); }, x => !IsBusy); PreviousMonthCommand = new DelegateCommand <object>(_ => { SelectedDate = SelectedDate.FirstDayOfPreviousMonth(); }, x => !IsBusy); CurrentMonthCommand = new DelegateCommand <object>(_ => SelectedDate = DateTime.Now.FirstDayOfMonth(), x => !IsBusy); SearchCommand = new DelegateCommand <object>(_ => DoSearchForecasts(), x => !IsBusy); ClearAllCommand = new DelegateCommand <object>(_ => DoClearAll(), x => !IsBusy); PrintCommand = new DelegateCommand <object>(_ => DoPrint(), x => !IsBusy); RemoveUserCommand = new DelegateCommand <object>(x => { var usrMonth = x as ForecastOverviewForecastMonth; if (usrMonth == null) { return; } UserRegistrations.Remove(usrMonth); }, x => !IsBusy); }