static void Main() { // Hook up so that we can fetch unhandled events. AppDomain currentDomain = AppDomain.CurrentDomain; currentDomain.UnhandledException += new UnhandledExceptionEventHandler(currentDomain_UnhandledException); System.Windows.Forms.Application.ThreadException += new ThreadExceptionEventHandler(currentDomain_ThreadException); // What does this actually do...? System.Windows.Forms.Application.EnableVisualStyles(); System.Windows.Forms.Application.SetCompatibleTextRenderingDefault(false); formConnect connectDlg = new formConnect(); if (!connectDlg.AutoConnect()) { if (connectDlg.ShowDialog() != DialogResult.OK) { // We failed to connect. Exit app again. return; } } hMailServer.Application application = connectDlg.Application; string serverHost = connectDlg.Server; System.Windows.Forms.Application.Run(new formMain(application, serverHost)); if (application != null) { Marshal.ReleaseComObject(application); } }
static void Main() { // Hook up so that we can fetch unhandled events. AppDomain currentDomain = AppDomain.CurrentDomain; currentDomain.UnhandledException += new UnhandledExceptionEventHandler(currentDomain_UnhandledException); System.Windows.Forms.Application.ThreadException += new ThreadExceptionEventHandler(currentDomain_ThreadException); // What does this actually do...? System.Windows.Forms.Application.EnableVisualStyles(); System.Windows.Forms.Application.SetCompatibleTextRenderingDefault(false); formConnect connectDlg = new formConnect(); if (!connectDlg.AutoConnect()) { if (connectDlg.ShowDialog() != DialogResult.OK) { // We failed to connect. Exit app again. return; } } hMailServer.Application application = connectDlg.Application; string serverHost = connectDlg.Server; System.Windows.Forms.Application.Run(new formMain(application, serverHost)); if (application != null) Marshal.ReleaseComObject(application); }