/// <summary> /// Implements the OnDisconnection method of the IDTExtensibility2 interface. /// Occurs when he Add-in is loaded into Visual Studio. /// </summary> /// <param name="application">A reference to an instance of the IDE, DTE.</param> /// <param name="connectMode"> /// An <see cref="ext_ConnectMode"/> enumeration value that indicates /// the way the add-in was loaded into Visual Studio. /// </param> /// <param name="instance">An <see cref="AddIn"/> reference to the add-in's own instance.</param> /// <param name="custom">An empty array that you can use to pass host-specific data for use in the add-in.</param> public void OnConnection(object application, ext_ConnectMode connectMode, object instance, ref Array custom) { App = (DTE2) application; Instance = (AddIn) instance; Events = App.Events as Events2; Logger = new OutputWindowLogger(App); Logger.Log("Loading..."); Compose(); // Do not attempt to use [Import]s before this line! if(Chirp == null) { Logger.Log("Unable to load."); return; } BindEvents(); PrintLoadedEngines(); Logger.Log("Ready"); if(App.Solution.IsOpen) { SolutionOpened(); foreach (var project in App.Solution.Projects.Cast<Project>()) { ProjectAdded(project); } } }
/// <summary> /// Implements the OnDisconnection method of the IDTExtensibility2 interface. /// Occurs when he Add-in is loaded into Visual Studio. /// </summary> /// <param name="application">A reference to an instance of the IDE, DTE.</param> /// <param name="connectMode"> /// An <see cref="ext_ConnectMode"/> enumeration value that indicates /// the way the add-in was loaded into Visual Studio. /// </param> /// <param name="instance">An <see cref="AddIn"/> reference to the add-in's own instance.</param> /// <param name="custom">An empty array that you can use to pass host-specific data for use in the add-in.</param> public void OnConnection(object application, ext_ConnectMode connectMode, object instance, ref Array custom) { App = (DTE2)application; Instance = (AddIn)instance; Events = App.Events as Events2; Logger = new OutputWindowLogger(App); Logger.Log("Loading..."); Compose(); // Do not attempt to use [Import]s before this line! if (Chirp == null) { Logger.Log("Unable to load."); return; } BindEvents(); PrintLoadedEngines(); Logger.Log("Ready"); if (App.Solution.IsOpen) { SolutionOpened(); foreach (var project in App.Solution.Projects.Cast <Project>()) { ProjectAdded(project); } } }
public void ShouldWriteInOutputWindow() { MockOutputWindow mockVsOutputWindow = new MockOutputWindow(); OutputWindowLogger logger = new OutputWindowLogger(mockVsOutputWindow); logger.Log("test"); Assert.IsTrue(mockVsOutputWindow.GetPaneCalled); Assert.AreEqual(ProjectLinkerGuids.GuidProjectLinkerOutputPane, mockVsOutputWindow.GetPaneArgumentGuidPane); StringAssert.Contains(mockVsOutputWindow.GetPaneReturnValue.OutputStringThreadSafeArgumentString, "test"); }
/// <summary> /// /// </summary> protected override void Initialize() { base.Initialize(); InitializeDTE(); LogLevel logLevel = LogLevel.Info; if (Debugger.IsAttached) { logLevel = LogLevel.Verbose; } logger = new OutputWindowLogger(dte, "TFS Productivity Pack", logLevel); try { logger.Log("TFSProductivityPackage Initialize", LogLevel.Info); commandService = GetService(typeof(IMenuCommandService)) as OleMenuCommandService; ITFSConnection tfsConnection = new TFSConnection(dte, logger); ITFSVersionControl tfsVersionControl = new TFSVersionControl(tfsConnection, dte, logger); ITFSBuildService tfsBuildService = new TFSBuildService(tfsConnection, this, logger); //showDeletedFilesCmd = new ToggleShowDeletedItemsCommand( // commandService, // logger, // tfsVersionControl); quickCompareCmd = new TFSQuickCompareCommand( commandService, logger, tfsVersionControl); findInSCEFromSolExpCmd = new FindInSCEFromSolExpCommand( commandService, logger, dte, tfsVersionControl); findInSCEFromCodeWindowCmd = new FindInSCEFromCodeWindowCommand( commandService, logger, dte, tfsVersionControl); findInSolExpFromCodeWindowCmd = new FindInSolExpFromCodeWindowCommand( commandService, logger, dte); compareToBranchCommand = new CompareToBranchCommand( commandService, logger, tfsVersionControl); branchBuildDefinitionCmd = new BranchBuildDefinitionCommand( commandService, logger, tfsBuildService, tfsVersionControl); CommandID comapreToBranchMenuID = new CommandID(GuidList.guidTFSProductivityPackCmdSet, PkgCmdIDList.menuIdCompareToBranchMenu); OleMenuCommand menuItem = new OleMenuCommand(null, comapreToBranchMenuID); menuItem.BeforeQueryStatus += compareToBranchCommand.ParentMenuQueryStatus; commandService.AddCommand(menuItem); } catch (Exception ex) { logger.Log(string.Format("Error initializing TFsProductivityPackage\n {0}", ex.ToString()), LogLevel.Error); } }