private void okButton_Click(object sender, RoutedEventArgs e) { try { double resolution = double.Parse(this._dpiTextBox.Text, NumberStyles.AllowLeadingWhite | NumberStyles.AllowTrailingWhite | NumberStyles.AllowDecimalPoint, CultureInfo.CurrentCulture); if (resolution <= 0) { var msgBox = ServiceLocator.Current.GetInstance <IMessageBoxService>(); msgBox.Show(MiniUML.Framework.Local.Strings.STR_MSG_INVALID_RESOLUTION, MiniUML.Framework.Local.Strings.STR_MSG_Warning_Caption, MsgBoxButtons.OK, MsgBoxImage.Warning); return; } ExportDocumentWindowViewModel viewModel = DataContext as ExportDocumentWindowViewModel; viewModel.prop_Resolution = resolution; this.DialogResult = true; this.Close(); } catch (SystemException) { var msgBox = ServiceLocator.Current.GetInstance <IMessageBoxService>(); msgBox.Show(MiniUML.Framework.Local.Strings.STR_MSG_PAGE_DEFINITION_FIELD_INVALID, MiniUML.Framework.Local.Strings.STR_MSG_Warning_Caption, MsgBoxButtons.OK, MsgBoxImage.Warning); } }
private void okButton_Click(object sender, RoutedEventArgs e) { try { double resolution = Double.Parse(_dpiTextBox.Text, NumberStyles.AllowLeadingWhite | NumberStyles.AllowTrailingWhite | NumberStyles.AllowDecimalPoint, CultureInfo.CurrentCulture); if (resolution <= 0) { ExceptionManager.ShowWarningDialog("Invalid resolution."); return; } ExportDocumentWindowViewModel viewModel = DataContext as ExportDocumentWindowViewModel; viewModel.prop_Resolution = resolution; this.DialogResult = true; this.Close(); } catch (SystemException) { ExceptionManager.ShowWarningDialog("One or more fields are not valid."); } }