private async Task ShowInternalAsync(CurrencyName dialog, string errorMessage) { dialog.ErrorMessage = errorMessage; ContentDialogResult result = await dialog.ShowAsync(); if ((result == ContentDialogResult.Primary || dialog.IsEnterPressed) && !String.IsNullOrEmpty(dialog.UniqueCode)) { await commandDispatcher.HandleAsync(new CreateCurrency(dialog.UniqueCode, dialog.Symbol)); } }
private static void OnErrorMessageChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { CurrencyName control = (CurrencyName)d; if (String.IsNullOrEmpty(control.ErrorMessage)) { control.tblError.Text = String.Empty; control.tblError.Visibility = Visibility.Collapsed; } else { control.tblError.Text = control.ErrorMessage; control.tblError.Visibility = Visibility.Visible; } }
private async Task ShowInternalAsync(CurrencyName dialog, string errorMessage) { dialog.ErrorMessage = errorMessage; ContentDialogResult result = await dialog.ShowAsync(); if ((result == ContentDialogResult.Primary || dialog.IsEnterPressed) && !String.IsNullOrEmpty(dialog.UniqueCode)) { try { // TODO: Not working after rewrite to commands. await commandDispatcher.HandleAsync(new CreateCurrency(dialog.UniqueCode, dialog.Symbol)); } catch (CurrencyAlreadyExistsException) { await ShowInternalAsync(dialog, messageBuilder.CurrencyAlreadyExists(dialog.UniqueCode)); } } }