示例#1
0
        void RunWorkbenchInternal(object settings)
        {
            WorkbenchSettings wbSettings = (WorkbenchSettings)settings;

            WorkbenchStartup wbc = new WorkbenchStartup();

            LoggingService.Info("Initializing workbench...");
            wbc.InitializeWorkbench();

            RunWorkbenchInitializedCommands();

            LoggingService.Info("Starting workbench...");
            Exception exception = null;

            // finally start the workbench.
            try {
                callback.BeforeRunWorkbench();
                if (Debugger.IsAttached)
                {
                    wbc.Run(wbSettings.InitialFileList);
                }
                else
                {
                    try {
                        wbc.Run(wbSettings.InitialFileList);
                    } catch (Exception ex) {
                        exception = ex;
                    }
                }
            } finally {
                LoggingService.Info("Unloading services...");
                try {
                    WorkbenchSingleton.OnWorkbenchUnloaded();
                    PropertyService.Save();
                } catch (Exception ex) {
                    LoggingService.Warn("Exception during unloading", ex);
                    if (exception == null)
                    {
                        exception = ex;
                    }
                }
            }
            LoggingService.Info("Finished running workbench.");
            callback.WorkbenchClosed();
            if (exception != null)
            {
                const string errorText = "Unhandled exception terminated the workbench";
                LoggingService.Fatal(exception);
                if (useSharpDevelopErrorHandler)
                {
                    System.Windows.Forms.Application.Run(new ExceptionBox(exception, errorText, true));
                }
                else
                {
                    throw new RunWorkbenchException(errorText, exception);
                }
            }
        }
示例#2
0
        void RunWorkbenchInternal(object settings)
        {
            WorkbenchSettings wbSettings = (WorkbenchSettings)settings;

            LoggingService.Info("Initializing workbench...");
#if ModifiedForAltaxo
            // TODO what to do here: WorkbenchSingleton.InitializeWorkbench(typeof(DefaultWorkbench));
#else
            WorkbenchSingleton.InitializeWorkbench();
#endif

            // initialize workbench-dependent services:
            Project.ProjectService.InitializeService();

            LoggingService.Info("Starting workbench...");
            Exception exception = null;
            // finally start the workbench.
            try {
                StartWorkbenchCommand wbc = new StartWorkbenchCommand();
                callback.BeforeRunWorkbench();
                if (Debugger.IsAttached)
                {
                    wbc.Run(wbSettings.InitialFileList);
                }
                else
                {
                    try {
                        wbc.Run(wbSettings.InitialFileList);
                    } catch (Exception ex) {
                        exception = ex;
                    }
                }
            } finally {
                LoggingService.Info("Unloading services...");
                try {
                    Project.ProjectService.CloseSolution();
                    FileService.Unload();
                    PropertyService.Save();
                } catch (Exception ex) {
                    LoggingService.Warn("Exception during unloading", ex);
                    if (exception != null)
                    {
                        exception = ex;
                    }
                }
            }
            LoggingService.Info("Finished running workbench.");
            callback.WorkbenchClosed();
            if (exception != null)
            {
                const string errorText = "Unhandled exception terminated the workbench";
                LoggingService.Fatal(exception);
                if (useSharpDevelopErrorHandler)
                {
                    System.Windows.Forms.Application.Run(new ExceptionBox(exception, errorText, true));
                }
                else
                {
                    throw new RunWorkbenchException(errorText, exception);
                }
            }
        }