コード例 #1
0
        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);
            }
        }
コード例 #2
0
ファイル: LayoutManager.cs プロジェクト: laeubisoft/pwiz
        public LayoutManager(IDPickerForm mainForm, DockPanel dockPanel, IList <IPersistentForm> persistentForms)
        {
            this.mainForm    = mainForm;
            _persistentForms = persistentForms;
            this.dockPanel   = dockPanel;

            refreshUserLayoutList();

            tryResetUserLayoutSettings();
        }
コード例 #3
0
ファイル: LayoutManager.cs プロジェクト: lgatto/proteowizard
        public LayoutManager(IDPickerForm mainForm, DockPanel dockPanel, IList<IPersistentForm> persistentForms)
        {
            this.mainForm = mainForm;
            _persistentForms = persistentForms;
            this.dockPanel = dockPanel;

            refreshUserLayoutList();

            tryResetUserLayoutSettings();
        }
コード例 #4
0
ファイル: Program.cs プロジェクト: lgatto/proteowizard
        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);
            }
        }