/// <summary> /// Create a new AppDomain to host SharpDevelop. /// </summary> public DevelopHost(StartupSettings startup) { if (startup == null) { throw new ArgumentNullException("startup"); } this.appDomain = CreateDomain(); helper = (CallHelper)appDomain.CreateInstanceAndUnwrap(SdaAssembly.FullName, typeof(CallHelper).FullName); helper.InitDevelopCore(new CallbackHelper(this), startup); initStatus = SDInitStatus.CoreInitialized; }
/// <summary> /// Unload the SharpDevelop AppDomain. This will force SharpDevelop to close /// without saving open files or changed settings. /// Call CloseWorkbench before UnloadDomain to prompt the user to save documents and settings. /// </summary> public void UnloadDomain() { if (initStatus != SDInitStatus.AppDomainUnloaded) { if (initStatus == SDInitStatus.WorkbenchInitialized) { helper.KillWorkbench(); } AppDomain.Unload(appDomain); initStatus = SDInitStatus.AppDomainUnloaded; } }
/// <summary> /// Create a new AppDomain to host SharpDevelop. /// </summary> public SharpDevelopHost(StartupSettings startup) { if (startup == null) { throw new ArgumentNullException("startup"); } this.appDomain = CreateDomain(); _servicesManager = (CoreServicesManager)appDomain.CreateInstanceAndUnwrap(SdaAssembly.FullName, typeof(CoreServicesManager).FullName); ServicesManager.InitSharpDevelopCore(new CallbackHelper(this), startup); initStatus = SDInitStatus.CoreInitialized; _applicationName = startup.ApplicationName; }
/// <summary> /// Initializes the workbench (create the MainForm instance, construct menu from AddInTree etc.) /// and runs it using the supplied settings. /// This starts a new message loop for the workbench. By default the message loop /// is created on a new thread, but you can change the settings so that /// it is created on the thread calling RunWorkbench. /// In that case, RunWorkbench will block until SharpDevelop is shut down! /// </summary> public void RunWorkbench(WorkbenchSettings settings) { if (settings == null) { throw new ArgumentNullException("settings"); } if (initStatus == SDInitStatus.CoreInitialized) { initStatus = SDInitStatus.Busy; helper.RunWorkbench(settings); if (settings.RunOnNewThread) { initStatus = SDInitStatus.WorkbenchInitialized; } } else { throw new InvalidOperationException(); } }