static void Main(string[] args) { // single instance code taken from // http://forge.fenchurch.mc.vanderbilt.edu/scm/viewvc.php/branches/IDPicker-3/Program.cs?revision=431&root=idpicker&view=markup var singleInstanceHandler = new SingleInstanceHandler(Application.ExecutablePath) { Timeout = 200 }; singleInstanceHandler.Launching += (sender, e) => { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); var singleInstanceArgs = e.Args.ToList(); MainWindow = new MainForm(singleInstanceArgs); Application.Run(MainWindow); }; try { singleInstanceHandler.Connect(args); } catch (Exception e) { HandleException(e); } }
static void Main(string[] args) { // redirect console output to parent process; // must be before any calls to Console.WriteLine() AttachConsole(ATTACH_PARENT_PROCESS); if (!args.Contains("--test-ui-layout")) { // Add the event handler for handling UI thread exceptions to the event. Application.ThreadException += UIThread_UnhandledException; // Set the unhandled exception mode to force all Windows Forms errors to go through our handler. Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException); // Add the event handler for handling non-UI thread exceptions to the event. AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; } var singleInstanceHandler = new SingleInstanceHandler(Application.ExecutablePath) { Timeout = 200 }; singleInstanceHandler.Launching += (sender, e) => { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); var singleInstanceArgs = e.Args.ToList(); IsHeadless = singleInstanceArgs.Contains("--headless"); if (IsHeadless) { singleInstanceArgs.RemoveAll(o => o == "--headless"); } // initialize webClient asynchronously initializeWebClient(); checkin(); automaticCheckForUpdates(); //HibernatingRhinos.Profiler.Appender.NHibernate.NHibernateProfiler.Initialize(); MainWindow = new IDPickerForm(singleInstanceArgs); Application.Run(MainWindow); }; try { singleInstanceHandler.Connect(args); } catch (Exception e) { HandleException(e); } }
static void Main(string[] args) { // single instance code taken from // http://forge.fenchurch.mc.vanderbilt.edu/scm/viewvc.php/branches/IDPicker-3/Program.cs?revision=431&root=idpicker&view=markup var singleInstanceHandler = new SingleInstanceHandler(Application.ExecutablePath) { Timeout = 200 }; singleInstanceHandler.Launching += (sender, e) => { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); var singleInstanceArgs = e.Args.ToList(); MainWindow = new MainForm(singleInstanceArgs); Application.Run(MainWindow); }; try { singleInstanceHandler.Connect(args); } catch (Exception e) { HandleException(e); } }
public static int Main(string[] args) { // redirect console output to parent process; // must be before any calls to Console.WriteLine() AttachConsole(ATTACH_PARENT_PROCESS); /*MSAnalysisClass a = new MSAnalysisClass(); * a.Open( @"C:\test\100 fmol BSA\0_B4\1\1SRef" ); * MSSpectrumCollection c = a.MSSpectrumCollection; * MSSpectrum s = c[1]; * MSSpectrumParameterCollection sp = s.MSSpectrumParameterCollection; * MSSpectrumParameter p = sp[1];*/ /*IAnalysisFactory factory = new AnalysisFactory(); * IAnalysis a = factory.Open( @"C:\test\MM48pos_20uM_1-A,8_01_9111.d" ); * ITraceDeclaration[] tdList = a.GetTraceDeclarations(); * List<ITraceDataCollection> tdcList = new List<ITraceDataCollection>(); * foreach( ITraceDeclaration td in tdList ) * tdcList.Add( a.GetTraceDataCollection( td.TraceId ) ); * ISpectrumSourceDeclaration[] ssdList = a.GetSpectrumSourceDeclarations(); * List<ISpectrumCollection> scList = new List<ISpectrumCollection>(); * foreach( ISpectrumSourceDeclaration ssd in ssdList ) * scList.Add( a.GetSpectrumCollection( ssd.SpectrumCollectionId ) );*/ // Add the event handler for handling UI thread exceptions to the event. Application.ThreadException += UIThread_UnhandledException; // Set the unhandled exception mode to force all Windows Forms errors to go through // our handler. Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); // Add the event handler for handling non-UI thread exceptions to the event. AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; var singleInstanceHandler = new SingleInstanceHandler(Application.ExecutablePath) { Timeout = 200 }; singleInstanceHandler.Launching += (sender, e) => { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); var singleInstanceArgs = e.Args.ToArray(); MainForm = new seemsForm(); MainForm.ParseArgs(singleInstanceArgs); if (!MainForm.IsDisposed) { Application.Run(MainForm); } e.ExitCode = Environment.ExitCode; }; try { TestMode = args.Contains("--test"); return(singleInstanceHandler.Connect(args)); } catch (Exception e) { HandleException("Error connecting to single instance", e); return(1); } }
public static void Main(string[] args) { // redirect console output to parent process; // must be before any calls to Console.WriteLine() AttachConsole(ATTACH_PARENT_PROCESS); /*MSAnalysisClass a = new MSAnalysisClass(); * a.Open( @"C:\test\100 fmol BSA\0_B4\1\1SRef" ); * MSSpectrumCollection c = a.MSSpectrumCollection; * MSSpectrum s = c[1]; * MSSpectrumParameterCollection sp = s.MSSpectrumParameterCollection; * MSSpectrumParameter p = sp[1];*/ /*IAnalysisFactory factory = new AnalysisFactory(); * IAnalysis a = factory.Open( @"C:\test\MM48pos_20uM_1-A,8_01_9111.d" ); * ITraceDeclaration[] tdList = a.GetTraceDeclarations(); * List<ITraceDataCollection> tdcList = new List<ITraceDataCollection>(); * foreach( ITraceDeclaration td in tdList ) * tdcList.Add( a.GetTraceDataCollection( td.TraceId ) ); * ISpectrumSourceDeclaration[] ssdList = a.GetSpectrumSourceDeclarations(); * List<ISpectrumCollection> scList = new List<ISpectrumCollection>(); * foreach( ISpectrumSourceDeclaration ssd in ssdList ) * scList.Add( a.GetSpectrumCollection( ssd.SpectrumCollectionId ) );*/ // Add the event handler for handling UI thread exceptions to the event. Application.ThreadException += new ThreadExceptionEventHandler(UIThread_UnhandledException); // Set the unhandled exception mode to force all Windows Forms errors to go through // our handler. Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); // Add the event handler for handling non-UI thread exceptions to the event. AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); var singleInstanceHandler = new SingleInstanceHandler(Application.ExecutablePath) { Timeout = 200 }; singleInstanceHandler.Launching += (sender, e) => { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); var singleInstanceArgs = e.Args.ToArray(); MainForm = new seemsForm(); MainForm.ParseArgs(singleInstanceArgs); if (!MainForm.IsDisposed) { Application.Run(MainForm); } }; try { singleInstanceHandler.Connect(args); } catch (Exception e) { string message = e.ToString(); if (e.InnerException != null) { message += "\n\nAdditional information: " + e.InnerException.ToString(); } MessageBox.Show(message, "Unhandled Exception", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, 0, false); } }
static void Main (string[] args) { // redirect console output to parent process; // must be before any calls to Console.WriteLine() AttachConsole(ATTACH_PARENT_PROCESS); if (!args.Contains("--test-ui-layout")) { // Add the event handler for handling UI thread exceptions to the event. Application.ThreadException += UIThread_UnhandledException; // Set the unhandled exception mode to force all Windows Forms errors to go through our handler. Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException); // Add the event handler for handling non-UI thread exceptions to the event. AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; } var singleInstanceHandler = new SingleInstanceHandler(Application.ExecutablePath) { Timeout = 200 }; singleInstanceHandler.Launching += (sender, e) => { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); var singleInstanceArgs = e.Args.ToList(); IsHeadless = singleInstanceArgs.Contains("--headless"); if (IsHeadless) singleInstanceArgs.RemoveAll(o => o == "--headless"); // initialize webClient asynchronously //initializeWebClient(); //automaticCheckForUpdates(); //HibernatingRhinos.Profiler.Appender.NHibernate.NHibernateProfiler.Initialize(); MainWindow = new IDPickerForm(singleInstanceArgs); Application.Run(MainWindow); }; try { singleInstanceHandler.Connect(args); } catch (Exception e) { HandleException(e); } }