public static void Main(string[] args) { MosaicApp.window = new MosaicWindow(); SingletonController.Receiver += new SingletonController.ReceiveDelegate(MosaicApp.GetPassedArgs); /* disabled the singleton control * // test if this is the first instance and register receiver, if so. * if (SingletonController.IamFirst()) * { */ if (args.Length > 0) { MosaicApp.window.SetStartupFiles(args); } Application.Run(window); /* * } * else * { * // send command line args to running app, then terminate * SingletonController.Send(args); * } */ SingletonController.Cleanup(); }
static void Main(string[] args) { ConfigHelper.LoadFromDefault(); bool singleInstanceOn = true; if (ConfigHelper.Current != null && ConfigHelper.Current.GeneralOptions != null) { singleInstanceOn = ConfigHelper.Current.GeneralOptions.IsSingleInstance; } if (!singleInstanceOn || SingletonController.IamFirst(new SingletonController.ReceiveDelegate(OnSingletonControllerReceive))) { if (User32.FindWindow(null, "PragmaSQL") != IntPtr.Zero) { if (SendJumpListMsg(args)) { return; } } Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.ThreadException += new ThreadExceptionEventHandler(Program.OnThreadException); splashScreen = new frmSplashScreen(); splashScreen.Show(); try { ICSharpCoreWrapper.StartCoreServices(); } catch (Exception ex) { frmSplashScreen.HideSplash(); GenericErrorDialog.ShowError("PragmaSQL Error", "Fatal Error : Core services can not be started.", ex); return; } AppDomain.CurrentDomain.AssemblyLoad += new AssemblyLoadEventHandler(splashScreen.ShowAssemblies); HostServices hostSvc = new HostServices(); #if PERSONAL_EDITION hostSvc.HostEdition = HostEditionType.Personal; #endif HostServicesSingleton.HostServices = hostSvc; _mainForm = new frmMain(); if (args != null && args.Length > 0) { FileInfo fi = new FileInfo(args[0]); if (fi.Exists) { if (fi.Extension.ToLowerInvariant() == ".sqlprj") { _mainForm.CommandLineProjectFileName = args[0]; } else { _mainForm.CommandLineScriptFileName = args[0]; } } } else { SendJumpListMsg(args); } Application.Run(_mainForm); } else { // send command line args to running app, then terminate SingletonController.Send(args); SingletonController.Cleanup(); } }