/// <summary> /// This is overridden to initialize the package /// </summary> /// <remarks>This method is called right after the package is sited, so /// this is the place where you can put all the initialization code /// that relies on services provided by Visual Studio.</remarks> protected override void Initialize() { Trace.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering Initialize() of: {0}", this.ToString())); base.Initialize(); SandcastleBuilderPackage.Instance = this; // Register the project factory this.RegisterProjectFactory(new SandcastleBuilderProjectFactory(this)); // Register the SHFB file editor factories base.RegisterEditorFactory(new ContentLayoutEditorFactory()); base.RegisterEditorFactory(new ResourceItemEditorFactory()); base.RegisterEditorFactory(new SiteMapEditorFactory()); base.RegisterEditorFactory(new TokenEditorFactory()); // Create the update solution event listener for build completed events buildCompletedListener = new BuildCompletedEventListener(this); ObjectExtenders objectExtenders = (ObjectExtenders)GetService(typeof(ObjectExtenders)); _singleFileGeneratorNodeExtenderProvider = new SingleFileGeneratorNodeExtenderProvider(); string extenderCatId = typeof(SandcastleBuilderFileNodeProperties).GUID.ToString("B"); string extenderName = SingleFileGeneratorNodeExtenderProvider.Name; string localizedName = extenderName; _singleFileGeneratorNodeExtenderCookie = objectExtenders.RegisterExtenderProvider(extenderCatId, extenderName, _singleFileGeneratorNodeExtenderProvider, localizedName); }
//===================================================================== /// <inheritdoc /> protected override void Dispose(bool disposing) { SandcastleBuilderPackage.Instance = null; if (buildCompletedListener != null) { buildCompletedListener.Dispose(); buildCompletedListener = null; } base.Dispose(disposing); }
//===================================================================== /// <inheritdoc /> protected override void Dispose(bool disposing) { if (disposing) { ObjectExtenders objectExtenders = (ObjectExtenders)GetService(typeof(ObjectExtenders)); objectExtenders.UnregisterExtenderProvider(_singleFileGeneratorNodeExtenderCookie); SandcastleBuilderPackage.Instance = null; if (buildCompletedListener != null) { buildCompletedListener.Dispose(); buildCompletedListener = null; } } base.Dispose(disposing); }
/// <summary> /// This is overridden to initialize the package /// </summary> /// <remarks>This method is called right after the package is sited, so this is the place where you can /// put all the initialization code that relies on services provided by Visual Studio.</remarks> protected override void Initialize() { Trace.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering Initialize() of {0}", this.ToString())); base.Initialize(); SandcastleBuilderPackage.Instance = this; // Add our command handlers for menu items (commands must exist in the .vsct file) OleMenuCommandService mcs = GetService(typeof(IMenuCommandService)) as OleMenuCommandService; if(mcs != null) { CommandID commandId; OleMenuCommand menuItem; // Create the command for button ViewHelpFile commandId = new CommandID(GuidList.guidSandcastleBuilderPackageCmdSet, (int)PkgCmdIDList.ViewHelpFile); menuItem = new OleMenuCommand(ViewHelpFileExecuteHandler, null, ViewHelpFileQueryStatusHandler, commandId); mcs.AddCommand(menuItem); // Create the command for button ViewHtmlHelp commandId = new CommandID(GuidList.guidSandcastleBuilderPackageCmdSet, (int)PkgCmdIDList.ViewHtmlHelp); menuItem = new OleMenuCommand(ViewHtmlHelpExecuteHandler, null, ViewHtmlHelpQueryStatusHandler, commandId); mcs.AddCommand(menuItem); // Create the command for button ViewMshcHelp commandId = new CommandID(GuidList.guidSandcastleBuilderPackageCmdSet, (int)PkgCmdIDList.ViewMshcHelp); menuItem = new OleMenuCommand(ViewMshcHelpExecuteHandler, null, ViewMshcHelpQueryStatusHandler, commandId); mcs.AddCommand(menuItem); // Create the command for button ViewAspNetWebsite commandId = new CommandID(GuidList.guidSandcastleBuilderPackageCmdSet, (int)PkgCmdIDList.ViewAspNetWebsite); menuItem = new OleMenuCommand(ViewAspNetWebsiteExecuteHandler, null, ViewAspNetWebsiteQueryStatusHandler, commandId); mcs.AddCommand(menuItem); // Create the command for button ViewHtmlWebsite commandId = new CommandID(GuidList.guidSandcastleBuilderPackageCmdSet, (int)PkgCmdIDList.ViewHtmlWebsite); menuItem = new OleMenuCommand(ViewHtmlWebsiteExecuteHandler, null, ViewHtmlWebsiteQueryStatusHandler, commandId); mcs.AddCommand(menuItem); // Create the command for button ViewFaq commandId = new CommandID(GuidList.guidSandcastleBuilderPackageCmdSet, (int)PkgCmdIDList.ViewFaq); menuItem = new OleMenuCommand(ViewFaqExecuteHandler, commandId); mcs.AddCommand(menuItem); // Create the command for button ViewShfbHelp commandId = new CommandID(GuidList.guidSandcastleBuilderPackageCmdSet, (int)PkgCmdIDList.ViewShfbHelp); menuItem = new OleMenuCommand(ViewShfbHelpExecuteHandler, commandId); mcs.AddCommand(menuItem); // Create the command for button OpenInStandaloneGUI commandId = new CommandID(GuidList.guidSandcastleBuilderPackageCmdSet, (int)PkgCmdIDList.OpenInStandaloneGUI); menuItem = new OleMenuCommand(OpenInStandaloneGUIExecuteHandler, null, OpenInStandaloneGUIQueryStatusHandler, commandId); mcs.AddCommand(menuItem); // Create the command for button ViewBuildLog commandId = new CommandID(GuidList.guidSandcastleBuilderPackageCmdSet, (int)PkgCmdIDList.ViewBuildLog); menuItem = new OleMenuCommand(ViewBuildLogExecuteHandler, null, ViewBuildLogQueryStatusHandler, commandId); mcs.AddCommand(menuItem); // Create the command for button EntityReferencesWindow commandId = new CommandID(GuidList.guidSandcastleBuilderPackageCmdSet, (int)PkgCmdIDList.EntityReferencesWindow); menuItem = new OleMenuCommand(EntityReferencesWindowExecuteHandler, commandId); mcs.AddCommand(menuItem); // Create the command for button TopicPreviewerWindow commandId = new CommandID(GuidList.guidSandcastleBuilderPackageCmdSet, (int)PkgCmdIDList.TopicPreviewerWindow); menuItem = new OleMenuCommand(TopicPreviewerWindowExecuteHandler, commandId); mcs.AddCommand(menuItem); // Create the command for button ViewDocxHelp commandId = new CommandID(GuidList.guidSandcastleBuilderPackageCmdSet, (int)PkgCmdIDList.ViewDocxHelp); menuItem = new OleMenuCommand(ViewDocxHelpExecuteHandler, null, ViewDocxHelpQueryStatusHandler, commandId); mcs.AddCommand(menuItem); } // Register the project factory this.RegisterProjectFactory(new SandcastleBuilderProjectFactory(this)); // Register the SHFB file editor factories base.RegisterEditorFactory(new ContentLayoutEditorFactory()); base.RegisterEditorFactory(new ResourceItemEditorFactory()); base.RegisterEditorFactory(new SiteMapEditorFactory()); base.RegisterEditorFactory(new TokenEditorFactory()); // Create the update solution event listener for build completed events buildCompletedListener = new BuildCompletedEventListener(this); // Register for solution events so that we can clear the component cache when necessary var dte = Microsoft.VisualStudio.Shell.Package.GetGlobalService(typeof(DTE)) as DTE; if(dte != null && dte.Events != null) { solutionEvents = dte.Events.SolutionEvents; if(solutionEvents != null) solutionEvents.AfterClosing += solutionEvents_AfterClosing; } }
//===================================================================== /// <inheritdoc /> protected override void Dispose(bool disposing) { SandcastleBuilderPackage.Instance = null; if(buildCompletedListener != null) { buildCompletedListener.Dispose(); buildCompletedListener = null; } base.Dispose(disposing); }
/// <summary> /// This is overridden to initialize the package /// </summary> /// <remarks>This method is called right after the package is sited, so this is the place where you can /// put all the initialization code that relies on services provided by Visual Studio.</remarks> protected override void Initialize() { Trace.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering Initialize() of {0}", this.ToString())); base.Initialize(); SandcastleBuilderPackage.Instance = this; // Add our command handlers for menu items (commands must exist in the .vsct file) OleMenuCommandService mcs = GetService(typeof(IMenuCommandService)) as OleMenuCommandService; if (mcs != null) { CommandID commandId; OleMenuCommand menuItem; // Create the command for button ViewHelpFile commandId = new CommandID(GuidList.guidSandcastleBuilderPackageCmdSet, (int)PkgCmdIDList.ViewHelpFile); menuItem = new OleMenuCommand(ViewHelpFileExecuteHandler, null, ViewHelpFileQueryStatusHandler, commandId); mcs.AddCommand(menuItem); // Create the command for button ViewHtmlHelp commandId = new CommandID(GuidList.guidSandcastleBuilderPackageCmdSet, (int)PkgCmdIDList.ViewHtmlHelp); menuItem = new OleMenuCommand(ViewHtmlHelpExecuteHandler, null, ViewHtmlHelpQueryStatusHandler, commandId); mcs.AddCommand(menuItem); // Create the command for button ViewHxSHelp commandId = new CommandID(GuidList.guidSandcastleBuilderPackageCmdSet, (int)PkgCmdIDList.ViewHxSHelp); menuItem = new OleMenuCommand(ViewHxSHelpExecuteHandler, null, ViewHxSHelpQueryStatusHandler, commandId); mcs.AddCommand(menuItem); // Create the command for button ViewMshcHelp commandId = new CommandID(GuidList.guidSandcastleBuilderPackageCmdSet, (int)PkgCmdIDList.ViewMshcHelp); menuItem = new OleMenuCommand(ViewMshcHelpExecuteHandler, null, ViewMshcHelpQueryStatusHandler, commandId); mcs.AddCommand(menuItem); // Create the command for button ViewAspNetWebsite commandId = new CommandID(GuidList.guidSandcastleBuilderPackageCmdSet, (int)PkgCmdIDList.ViewAspNetWebsite); menuItem = new OleMenuCommand(ViewAspNetWebsiteExecuteHandler, null, ViewAspNetWebsiteQueryStatusHandler, commandId); mcs.AddCommand(menuItem); // Create the command for button ViewHtmlWebsite commandId = new CommandID(GuidList.guidSandcastleBuilderPackageCmdSet, (int)PkgCmdIDList.ViewHtmlWebsite); menuItem = new OleMenuCommand(ViewHtmlWebsiteExecuteHandler, null, ViewHtmlWebsiteQueryStatusHandler, commandId); mcs.AddCommand(menuItem); // Create the command for button ViewFaq commandId = new CommandID(GuidList.guidSandcastleBuilderPackageCmdSet, (int)PkgCmdIDList.ViewFaq); menuItem = new OleMenuCommand(ViewFaqExecuteHandler, commandId); mcs.AddCommand(menuItem); // Create the command for button ViewShfbHelp commandId = new CommandID(GuidList.guidSandcastleBuilderPackageCmdSet, (int)PkgCmdIDList.ViewShfbHelp); menuItem = new OleMenuCommand(ViewShfbHelpExecuteHandler, commandId); mcs.AddCommand(menuItem); // Create the command for button OpenInStandaloneGUI commandId = new CommandID(GuidList.guidSandcastleBuilderPackageCmdSet, (int)PkgCmdIDList.OpenInStandaloneGUI); menuItem = new OleMenuCommand(OpenInStandaloneGUIExecuteHandler, null, OpenInStandaloneGUIQueryStatusHandler, commandId); mcs.AddCommand(menuItem); // Create the command for button ViewBuildLog commandId = new CommandID(GuidList.guidSandcastleBuilderPackageCmdSet, (int)PkgCmdIDList.ViewBuildLog); menuItem = new OleMenuCommand(ViewBuildLogExecuteHandler, null, ViewBuildLogQueryStatusHandler, commandId); mcs.AddCommand(menuItem); // Create the command for button EntityReferencesWindow commandId = new CommandID(GuidList.guidSandcastleBuilderPackageCmdSet, (int)PkgCmdIDList.EntityReferencesWindow); menuItem = new OleMenuCommand(EntityReferencesWindowExecuteHandler, commandId); mcs.AddCommand(menuItem); // Create the command for button TopicPreviewerWindow commandId = new CommandID(GuidList.guidSandcastleBuilderPackageCmdSet, (int)PkgCmdIDList.TopicPreviewerWindow); menuItem = new OleMenuCommand(TopicPreviewerWindowExecuteHandler, commandId); mcs.AddCommand(menuItem); // Create the command for button ViewDocxHelp commandId = new CommandID(GuidList.guidSandcastleBuilderPackageCmdSet, (int)PkgCmdIDList.ViewDocxHelp); menuItem = new OleMenuCommand(ViewDocxHelpExecuteHandler, null, ViewDocxHelpQueryStatusHandler, commandId); mcs.AddCommand(menuItem); } // Register the project factory this.RegisterProjectFactory(new SandcastleBuilderProjectFactory(this)); // Register the SHFB file editor factories base.RegisterEditorFactory(new ContentLayoutEditorFactory()); base.RegisterEditorFactory(new ResourceItemEditorFactory()); base.RegisterEditorFactory(new SiteMapEditorFactory()); base.RegisterEditorFactory(new TokenEditorFactory()); // Create the update solution event listener for build completed events buildCompletedListener = new BuildCompletedEventListener(this); }
//===================================================================== /// <inheritdoc /> protected override void Dispose(bool disposing) { if (disposing) { ObjectExtenders objectExtenders = (ObjectExtenders)GetService(typeof(ObjectExtenders)); objectExtenders.UnregisterExtenderProvider(_singleFileGeneratorNodeExtenderCookie); SandcastleBuilderPackage.Instance = null; if(buildCompletedListener != null) { buildCompletedListener.Dispose(); buildCompletedListener = null; } } base.Dispose(disposing); }
/// <summary> /// This is overridden to initialize the package /// </summary> /// <remarks>This method is called right after the package is sited, so this is the place where you can /// put all the initialization code that relies on services provided by Visual Studio.</remarks> protected override void Initialize() { Trace.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering Initialize() of {0}", this.ToString())); base.Initialize(); SandcastleBuilderPackage.Instance = this; // Add our command handlers for menu items (commands must exist in the .vsct file) OleMenuCommandService mcs = GetService(typeof(IMenuCommandService)) as OleMenuCommandService; if (mcs != null) { CommandID commandId; OleMenuCommand menuItem; // Create the command for button ViewHelpFile commandId = new CommandID(GuidList.guidSandcastleBuilderPackageCmdSet, (int)PkgCmdIDList.ViewHelpFile); menuItem = new OleMenuCommand(ViewHelpFileExecuteHandler, null, ViewHelpFileQueryStatusHandler, commandId); mcs.AddCommand(menuItem); // Create the command for button ViewHtmlHelp commandId = new CommandID(GuidList.guidSandcastleBuilderPackageCmdSet, (int)PkgCmdIDList.ViewHtmlHelp); menuItem = new OleMenuCommand(ViewHtmlHelpExecuteHandler, null, ViewHtmlHelpQueryStatusHandler, commandId); mcs.AddCommand(menuItem); // Create the command for button ViewMshcHelp commandId = new CommandID(GuidList.guidSandcastleBuilderPackageCmdSet, (int)PkgCmdIDList.ViewMshcHelp); menuItem = new OleMenuCommand(ViewMshcHelpExecuteHandler, null, ViewMshcHelpQueryStatusHandler, commandId); mcs.AddCommand(menuItem); // Create the command for button ViewAspNetWebsite commandId = new CommandID(GuidList.guidSandcastleBuilderPackageCmdSet, (int)PkgCmdIDList.ViewAspNetWebsite); menuItem = new OleMenuCommand(ViewAspNetWebsiteExecuteHandler, null, ViewAspNetWebsiteQueryStatusHandler, commandId); mcs.AddCommand(menuItem); // Create the command for button ViewHtmlWebsite commandId = new CommandID(GuidList.guidSandcastleBuilderPackageCmdSet, (int)PkgCmdIDList.ViewHtmlWebsite); menuItem = new OleMenuCommand(ViewHtmlWebsiteExecuteHandler, null, ViewHtmlWebsiteQueryStatusHandler, commandId); mcs.AddCommand(menuItem); // Create the command for button ViewFaq commandId = new CommandID(GuidList.guidSandcastleBuilderPackageCmdSet, (int)PkgCmdIDList.ViewFaq); menuItem = new OleMenuCommand(ViewFaqExecuteHandler, commandId); mcs.AddCommand(menuItem); // Create the command for button ViewShfbHelp commandId = new CommandID(GuidList.guidSandcastleBuilderPackageCmdSet, (int)PkgCmdIDList.ViewShfbHelp); menuItem = new OleMenuCommand(ViewShfbHelpExecuteHandler, commandId); mcs.AddCommand(menuItem); // Create the command for button OpenInStandaloneGUI commandId = new CommandID(GuidList.guidSandcastleBuilderPackageCmdSet, (int)PkgCmdIDList.OpenInStandaloneGUI); menuItem = new OleMenuCommand(OpenInStandaloneGUIExecuteHandler, null, OpenInStandaloneGUIQueryStatusHandler, commandId); mcs.AddCommand(menuItem); // Create the command for button ViewBuildLog commandId = new CommandID(GuidList.guidSandcastleBuilderPackageCmdSet, (int)PkgCmdIDList.ViewBuildLog); menuItem = new OleMenuCommand(ViewBuildLogExecuteHandler, null, ViewBuildLogQueryStatusHandler, commandId); mcs.AddCommand(menuItem); // Create the command for button EntityReferencesWindow commandId = new CommandID(GuidList.guidSandcastleBuilderPackageCmdSet, (int)PkgCmdIDList.EntityReferencesWindow); menuItem = new OleMenuCommand(EntityReferencesWindowExecuteHandler, commandId); mcs.AddCommand(menuItem); // Create the command for button TopicPreviewerWindow commandId = new CommandID(GuidList.guidSandcastleBuilderPackageCmdSet, (int)PkgCmdIDList.TopicPreviewerWindow); menuItem = new OleMenuCommand(TopicPreviewerWindowExecuteHandler, commandId); mcs.AddCommand(menuItem); // Create the command for button ViewDocxHelp commandId = new CommandID(GuidList.guidSandcastleBuilderPackageCmdSet, (int)PkgCmdIDList.ViewDocxHelp); menuItem = new OleMenuCommand(ViewDocxHelpExecuteHandler, null, ViewDocxHelpQueryStatusHandler, commandId); mcs.AddCommand(menuItem); } // Register the project factory this.RegisterProjectFactory(new SandcastleBuilderProjectFactory(this)); // Register the SHFB file editor factories base.RegisterEditorFactory(new ContentLayoutEditorFactory()); base.RegisterEditorFactory(new ResourceItemEditorFactory()); base.RegisterEditorFactory(new SiteMapEditorFactory()); base.RegisterEditorFactory(new TokenEditorFactory()); // Create the update solution event listener for build completed events buildCompletedListener = new BuildCompletedEventListener(this); // Register for solution events so that we can clear the component cache when necessary var dte = Microsoft.VisualStudio.Shell.Package.GetGlobalService(typeof(DTE)) as DTE; if (dte != null) { if (dte.Events != null) { solutionEvents = dte.Events.SolutionEvents; if (solutionEvents != null) { solutionEvents.AfterClosing += solutionEvents_AfterClosing; } } try { // Set the owning window for WPF modal dialogs to the main Visual Studio window Sandcastle.Core.WpfHelpers.MainWindowHandle = new IntPtr(dte.MainWindow.HWnd); } catch { // Ignore exceptions. There is no main window when invoked for a command line build. // It may also try to load the package before the main window is available if tool windows // were left open. Worst case, modal dialogs may not appear over the main form on dual // monitor systems. } } }
/// <summary> /// This is overridden to initialize the package /// </summary> /// <remarks>This method is called right after the package is sited, so this is the place where you can /// put all the initialization code that relies on services provided by Visual Studio.</remarks> protected override async System.Threading.Tasks.Task InitializeAsync( System.Threading.CancellationToken cancellationToken, IProgress <ServiceProgressData> progress) { Trace.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering Initialize() of {0}", this.ToString())); await base.InitializeAsync(cancellationToken, progress); // When initialized asynchronously, we may be on a background thread at this point. Do any // initialization that requires the UI thread after switching to the UI thread. await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); SandcastleBuilderPackage.Instance = this; // Add our command handlers for menu items (commands must exist in the .vsct file) if (await this.GetServiceAsync(typeof(IMenuCommandService)) is OleMenuCommandService mcs) { CommandID commandId; OleMenuCommand menuItem; // Create the command for button ViewHelpFile commandId = new CommandID(GuidList.guidSandcastleBuilderPackageCmdSet, (int)PkgCmdIDList.ViewHelpFile); menuItem = new OleMenuCommand(ViewHelpFileExecuteHandler, null, ViewHelpFileQueryStatusHandler, commandId); mcs.AddCommand(menuItem); // Create the command for button ViewHtmlHelp commandId = new CommandID(GuidList.guidSandcastleBuilderPackageCmdSet, (int)PkgCmdIDList.ViewHtmlHelp); menuItem = new OleMenuCommand(ViewHtmlHelpExecuteHandler, null, ViewHtmlHelpQueryStatusHandler, commandId); mcs.AddCommand(menuItem); // Create the command for button ViewMshcHelp commandId = new CommandID(GuidList.guidSandcastleBuilderPackageCmdSet, (int)PkgCmdIDList.ViewMshcHelp); menuItem = new OleMenuCommand(ViewMshcHelpExecuteHandler, null, ViewMshcHelpQueryStatusHandler, commandId); mcs.AddCommand(menuItem); // Create the command for button ViewAspNetWebsite commandId = new CommandID(GuidList.guidSandcastleBuilderPackageCmdSet, (int)PkgCmdIDList.ViewAspNetWebsite); menuItem = new OleMenuCommand(ViewAspNetWebsiteExecuteHandler, null, ViewAspNetWebsiteQueryStatusHandler, commandId); mcs.AddCommand(menuItem); // Create the command for button ViewFaq commandId = new CommandID(GuidList.guidSandcastleBuilderPackageCmdSet, (int)PkgCmdIDList.ViewFaq); menuItem = new OleMenuCommand(ViewFaqExecuteHandler, commandId); mcs.AddCommand(menuItem); // Create the command for button ViewShfbHelp commandId = new CommandID(GuidList.guidSandcastleBuilderPackageCmdSet, (int)PkgCmdIDList.ViewShfbHelp); menuItem = new OleMenuCommand(ViewShfbHelpExecuteHandler, commandId); mcs.AddCommand(menuItem); // Create the command for button OpenInStandaloneGUI commandId = new CommandID(GuidList.guidSandcastleBuilderPackageCmdSet, (int)PkgCmdIDList.OpenInStandaloneGUI); menuItem = new OleMenuCommand(OpenInStandaloneGUIExecuteHandler, null, OpenInStandaloneGUIQueryStatusHandler, commandId); mcs.AddCommand(menuItem); // Create the command for button ViewBuildLog commandId = new CommandID(GuidList.guidSandcastleBuilderPackageCmdSet, (int)PkgCmdIDList.ViewBuildLog); menuItem = new OleMenuCommand(ViewBuildLogExecuteHandler, null, ViewBuildLogQueryStatusHandler, commandId); mcs.AddCommand(menuItem); // Create the command for button EntityReferencesWindow commandId = new CommandID(GuidList.guidSandcastleBuilderPackageCmdSet, (int)PkgCmdIDList.EntityReferencesWindow); menuItem = new OleMenuCommand(EntityReferencesWindowExecuteHandler, commandId); mcs.AddCommand(menuItem); // Create the command for button TopicPreviewerWindow commandId = new CommandID(GuidList.guidSandcastleBuilderPackageCmdSet, (int)PkgCmdIDList.TopicPreviewerWindow); menuItem = new OleMenuCommand(TopicPreviewerWindowExecuteHandler, commandId); mcs.AddCommand(menuItem); // Create the command for button ViewDocxHelp commandId = new CommandID(GuidList.guidSandcastleBuilderPackageCmdSet, (int)PkgCmdIDList.ViewDocxHelp); menuItem = new OleMenuCommand(ViewDocxHelpExecuteHandler, null, ViewDocxHelpQueryStatusHandler, commandId); mcs.AddCommand(menuItem); } // Register the project factory this.RegisterProjectFactory(new SandcastleBuilderProjectFactory(this)); // Register the SHFB file editor factories base.RegisterEditorFactory(new ContentLayoutEditorFactory()); base.RegisterEditorFactory(new ResourceItemEditorFactory()); base.RegisterEditorFactory(new SiteMapEditorFactory()); base.RegisterEditorFactory(new TokenEditorFactory()); // Create the update solution event listener for build completed events buildCompletedListener = new BuildCompletedEventListener(this); // Register for solution events so that we can clear the component cache when necessary Microsoft.VisualStudio.Shell.Events.SolutionEvents.OnAfterCloseSolution += (s, e) => ComponentCache.Clear(); try { // Set the owning window for WPF modal dialogs to the main Visual Studio window Sandcastle.Platform.Windows.WpfHelpers.MainWindowHandle = System.Diagnostics.Process.GetCurrentProcess().MainWindowHandle; } catch { // Ignore exceptions. There is no main window when invoked for a command line build. // It may also try to load the package before the main window is available if tool windows // were left open. Worst case, modal dialogs may not appear over the main form on dual // monitor systems. } }