From 2e00cfd1e9a91eaff77b87534fa9e3a19af4e41b Mon Sep 17 00:00:00 2001 From: HuskyTeufel Date: Wed, 20 Apr 2022 15:56:48 +0200 Subject: [PATCH] Programm message box Wenn kein Dongle gefunden wurde, wird meldung angezeigt --- SanSystem/Program.cs | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/SanSystem/Program.cs b/SanSystem/Program.cs index 3495a75..a6fe33a 100644 --- a/SanSystem/Program.cs +++ b/SanSystem/Program.cs @@ -25,23 +25,29 @@ namespace SanSystem Environment.Exit(1); } #if !DEBUG - using (Dongle dongle = new Dongle(60)) + try { - if (dongle.CheckDongleVorhanden()) + using (Dongle dongle = new Dongle(60)) { - dongle.CleanDongle(); - - - Application.EnableVisualStyles(); - Application.SetCompatibleTextRenderingDefault(false); - Application.Run(new frmMain()); - } - else - { - MessageBox.Show("Sorry es wurde kein Dongle gefunden!"); - Application.Exit(); + if (dongle.CheckDongleVorhanden()) + { + dongle.CleanDongle(); + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new frmMain()); + } + else + { + MessageBox.Show("Sorry es wurde kein Dongle gefunden!"); + Application.Exit(); + } } } + catch (Exception ex) + { + MessageBox.Show("Sorry es wurde kein Dongle gefunden!\n" + ex.Message); + Application.Exit(); + } #else Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false);