static void Main() { // initialize app Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.ThreadException += new ThreadExceptionEventHandler(Application_ThreadException); Application.ThreadExit += new EventHandler(Application_ThreadExit); Control.CheckForIllegalCrossThreadCalls = false; // Check if instance of AEM manager is already running bool fFirstInstance; mStartupMutex = new Mutex(false, "AEMManager_Mutex@@1", out fFirstInstance); if (!fFirstInstance) { MessageBox.Show("AEM Manager already started.", "AEM Manager", MessageBoxButtons.OK, MessageBoxIcon.Information); mStartupMutex.Close(); Application.Exit(); return; } // check if registry settings should be migrated RegistryMigration.CheckForLegacyRegistrySettings(); // initialice tray icon InitializeNotifyIcon(); // run application main thread Program.AemManagerForm = new AemManager(); Program.AemManagerForm.Visible = false; Application.Run(Program.AemManagerForm); }