コード例 #1
0
        public Task ShowAsync(object rawParameter)
        {
            CurrencyAddExchangeRateParameter parameter = (CurrencyAddExchangeRateParameter)rawParameter;

            CurrencyExchangeRate dialog = new CurrencyExchangeRate(queryDispatcher);

            dialog.TargetCurrency = parameter.TargetCurrency;
            return(ShowInternalAsync(dialog, null));
        }
コード例 #2
0
        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;
            }
        }
コード例 #3
0
        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
                                                        ));
            }
        }
コード例 #4
0
        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());
                }
            }
        }
コード例 #5
0
        private static void OnTargetCurrencyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            CurrencyExchangeRate control = (CurrencyExchangeRate)d;

            control.OnTargetCurrencyChanged();
        }