Ejemplo n.º 1
0
        private void ConvertToWordsCommand(object commandParameter)
        {
            var validation = _inputValidator.Validate(InputNumber);

            if (validation.IsValid)
            {
                try
                {
                    OutputText = _wcfConvertService.ConvertNumberToWords(InputNumber);
                    OnPropertyChanged(nameof(OutputText));
                }
                catch (EndpointNotFoundException e)
                {
                    MessageBox.Show($"Could not connect to the server.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                }
                catch (Exception e)
                {
                    MessageBox.Show($"{e.Message}", "Error", MessageBoxButton.OK, MessageBoxImage.Warning);
                }
            }
            else
            {
                ShowErrorMessageBox(validation.ValidationErrors);
            }
        }