public void ChangeValidateCanExecute() { try { bool validatesDateRange = _validateDateRange() == null; if (validatesDateRange) { _validateCommand.ChangeCanExecute(); } } catch (Exception ex) { Logger.Log(ex); } }
private void _client_selected(object sender, EventArgs e) { bool nothingSelected = _searchClientVMsView.CurrentPosition == -1; bool somethingSelected = !nothingSelected; bool canExecute = _selectClientCommand.CanExecute(null); bool cannotExecute = !canExecute; if ( (nothingSelected && canExecute) || (somethingSelected && cannotExecute) ) { _selectClientCommand.ChangeCanExecute(); } }
private void _clientBookingsView_currentChanged(object sender, EventArgs e) { bool nothingSelected = _clientBookingsView.CurrentPosition == -1; bool somethingSelected = !nothingSelected; bool canExecute = _selectBookingCommand.CanExecute(null); if ( (somethingSelected && !canExecute) || (nothingSelected && canExecute) ) { _selectBookingCommand.ChangeCanExecute(); _cancelBookingCommand.ChangeCanExecute(); } }
private void _unlockSaveAndSumUpIfNeeded() { bool canSave = _saveClientCommand.CanExecute(null); bool canSumUp = _sumUpCommand.CanExecute(null); bool isValid = ((IDataErrorInfo)_clientEntity).Error == null; if ((canSave && !isValid) || (!canSave && isValid) ) { _saveClientCommand.ChangeCanExecute(); } if ((canSumUp && !isValid) || (!canSumUp && isValid) ) { _sumUpCommand.ChangeCanExecute(); } }