private async void OnCommitCreateParameter() { if (!(SelectedEventParameter.Id == 0 && SelectedEventParameter.IsValid())) { MessageBox.Show("Error. Make sure that the new parameter is selected and that Property Name and Variable fields have values.", AppName, MessageBoxButton.OK, MessageBoxImage.Error); return; } MessageBoxResult messageBoxResult = MessageBox.Show("Proceed with creation? Click Cancel to continue editing or No to discard changes.", AppName, MessageBoxButton.YesNoCancel, MessageBoxImage.Question); if (messageBoxResult == MessageBoxResult.Cancel) { return; } else if (messageBoxResult == MessageBoxResult.No) { OnCancelCreateParameter(); } else { //Create Event Parameter if Yes string result = await _eventParameterService.CreateEventParameter(SelectedEvent.Id, SelectedEventParameter); MessageBox.Show(result, AppName, MessageBoxButton.OK, MessageBoxImage.Information); GetEventParameters(SelectedEvent.Id); } CreatingItem = false; CreateParameterCommand.RaiseCanExecuteChanged(); UpdateParameterCommand.RaiseCanExecuteChanged(); DeleteParameterCommand.RaiseCanExecuteChanged(); RefreshParametersCommand.RaiseCanExecuteChanged(); }
private bool CanUpdateParameter() { return(SelectedEventParameter != null && SelectedEventParameter.IsValid() && !CreatingItem); }