コード例 #1
0
        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));
            }
        }
コード例 #2
0
        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;
            }
        }
コード例 #3
0
        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));
                }
            }
        }