static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); try { var mainForm = new Form(); mainForm.Load += (object sender, EventArgs e) => { mainForm.Visible = false; mainForm.ShowInTaskbar = false; }; mainForm.FormClosed += (object sender, FormClosedEventArgs e) => { Application.Exit(); }; using (var applicationContext = new SquidApplicationContext(mainForm)) { Application.Run(applicationContext); } } catch (Exception ex) { MessageBox.Show( ex.Message, "Squid Terminated Unexpectedly", MessageBoxButtons.OK, MessageBoxIcon.Error); } }