static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); //try //{ ComSelector selector = new ComSelector(); Application.Run(selector); string comPort = selector.GetPort(); if (comPort != null) { GUI gui = new GUI(comPort); Application.Run(gui); } //} catch(Exception) //{ //} }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); try { ComSelector selector = new ComSelector(); Application.Run(selector); string comPort = selector.GetPort(); if (comPort != null) { GUI gui = new GUI(comPort); Application.Run(gui); } } catch(Exception ex) { MessageBox.Show("Exception occurred in GUI!\n" + "Reason: " + ex.Message); } }