public Task ShowAsync(object rawParameter) { CurrencyAddExchangeRateParameter parameter = (CurrencyAddExchangeRateParameter)rawParameter; CurrencyExchangeRate dialog = new CurrencyExchangeRate(queryDispatcher); dialog.TargetCurrency = parameter.TargetCurrency; return(ShowInternalAsync(dialog, null)); }
private static void OnErrorMessageChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { CurrencyExchangeRate control = (CurrencyExchangeRate)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(CurrencyExchangeRate dialog, string errorMessage) { dialog.ErrorMessage = errorMessage; ContentDialogResult result = await dialog.ShowAsync(); if (result == ContentDialogResult.Primary) { await commandDispatcher.HandleAsync(new SetExchangeRate( dialog.SourceCurrency, dialog.TargetCurrency, dialog.ValidFrom, dialog.Rate )); } }
private async Task ShowInternalAsync(CurrencyExchangeRate dialog, string errorMessage) { dialog.ErrorMessage = errorMessage; ContentDialogResult result = await dialog.ShowAsync(); if (result == ContentDialogResult.Primary) { try { // TODO: Not working after rewrite to commands. await commandDispatcher.HandleAsync(new SetExchangeRate( dialog.SourceCurrency, dialog.TargetCurrency, dialog.ValidFrom, dialog.Rate )); } catch (CurrencyExchangeRateAlreadyExistsException) { await ShowInternalAsync(dialog, messageBuilder.CurrencyExchangeRateAlreadyExists()); } } }
private static void OnTargetCurrencyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { CurrencyExchangeRate control = (CurrencyExchangeRate)d; control.OnTargetCurrencyChanged(); }