From 925f777d367ec5f84eaed4a856f05d301821ece8 Mon Sep 17 00:00:00 2001 From: Thorsten Sommer Date: Sun, 17 Jul 2022 12:32:43 +0200 Subject: [PATCH] Added automatic error handling to show a message box --- I18N Commander/UI WinForms/ExtensionsError.cs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 I18N Commander/UI WinForms/ExtensionsError.cs diff --git a/I18N Commander/UI WinForms/ExtensionsError.cs b/I18N Commander/UI WinForms/ExtensionsError.cs new file mode 100644 index 0000000..0873d09 --- /dev/null +++ b/I18N Commander/UI WinForms/ExtensionsError.cs @@ -0,0 +1,15 @@ +using Processor; + +namespace UI_WinForms; + +public static class ExtensionsError +{ + public static ProcessorResult ProcessError(this ProcessorResult result) + { + if (result.Successful) + return result; + + MessageBox.Show(result.ErrorMessage, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); + return result; + } +} \ No newline at end of file