static void Main() { AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); Mutex mutex = null; AppDomain.CurrentDomain.ProcessExit += new EventHandler((sender, e) => { if (mutex != null) { mutex.Dispose(); } }); bool createdNew = true; mutex = new Mutex(true, "Fonlow.SyncMLClientOpenContacts", out createdNew); if (!createdNew) { MessageBox.Show("Another instance of SyncML Client for Open Contacts is running.", "SyncML Client for Open Contacts"); return; } Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); OcSyncSettings settings = OcSyncSettings.Default; Application.Run(UcMultiSyncMain.CreateMainForm(settings)); }
void LoadSyncForm() { if (syncForm == null) { syncForm = UcMultiSyncMain.CreateMainForm(OutlookSyncSettings.Default); syncForm.FormClosed += new System.Windows.Forms.FormClosedEventHandler(syncForm_FormClosed); } }