/// <summary> /// This function is called when the user clicks the menu item that shows the /// tool window. See the Initialize method to see how the menu item is associated to /// this function using the OleMenuCommandService service and the MenuCommand class. /// </summary> private void ShowToolWindow(object sender, EventArgs e) { try { var ext = GetTeamFoundationServerExt(); IVsTeamFoundationBuild vstfBuild = (IVsTeamFoundationBuild)GetService(typeof(IVsTeamFoundationBuild)); // Get the instance number 0 of this tool window. This window is single instance so this instance is actually the only one. // The last flag is set to true so that if the tool window does not exists it will be created. ToolWindowPane window = this.FindToolWindow(typeof(BuildManagerToolWindow), 0, true); if ((null == window) || (null == window.Frame)) { throw new NotSupportedException(Resources.CanNotCreateWindow); } var wnd = window as BuildManagerToolWindow; wnd.InitializeExtension(ext, vstfBuild); IVsWindowFrame windowFrame = (IVsWindowFrame)window.Frame; Microsoft.VisualStudio.ErrorHandler.ThrowOnFailure(windowFrame.Show()); } catch (Exception ex) { ShowErrorMessage(ex); } }
public async override void Initialize(object sender, SectionInitializeEventArgs e) { base.Initialize(sender, e); _buildService = GetService <IVsTeamFoundationBuild>(); _dte = GetService <DTE>(); _dteEvents = _dte.Events; _dteDocumentEvents = _dte.Events.DocumentEvents; _dteDocumentEvents.DocumentSaved += _dteDocumentEvents_DocumentSaved; _optionsViewModel.OptionsModel.Initialize(this.ServiceProvider); var sectionContext = e.Context as BuildsSectionContext; if (sectionContext != null) { Builds = sectionContext.Builds; } else { await RefreshAsync(); } }
///////////////////////////////////////////////////////////////////////////// // Overriden Package Implementation #region Package Members /// <summary> /// Initialization of the package; this method is called right after the package is sited, so this is the place /// where you can put all the initilaization code that rely on services provided by VisualStudio. /// </summary> protected override void Initialize() { try { Trace.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering Initialize() of: {0}", this.ToString())); base.Initialize(); // Add our command handlers for menu (commands must exist in the .vsct file) OleMenuCommandService mcs = GetService(typeof(IMenuCommandService)) as OleMenuCommandService; if (null != mcs) { // Create the command for the tool window CommandID toolwndCommandID = new CommandID(GuidList.guidPowerDeliveryVSExtensionCmdSet, (int)PkgCmdIDList.cmdidDeploymentPipelines); MenuCommand menuToolWin = new MenuCommand(ShowToolWindow, toolwndCommandID); mcs.AddCommand(menuToolWin); } ToolWindowPane window = this.FindToolWindow(typeof(MyToolWindow), 0, true); if (window != null) { MyToolWindow myWindow = (MyToolWindow)window; IVsTeamFoundationBuild tfsBuild = (IVsTeamFoundationBuild)GetService(typeof(IVsTeamFoundationBuild)); MyControl myControl = (MyControl)myWindow.Content; myControl.Package = this; myControl.TfsBuild = tfsBuild; } } catch (Exception ex) { ActivityLog.LogError("PowerDeliveryVSExtension2012", string.Format("Message: {0} Stack: {1}", ex.Message, ex.StackTrace)); } }
/// <summary> /// This function is called when the user clicks the menu item that shows the /// tool window. See the Initialize method to see how the menu item is associated to /// this function using the OleMenuCommandService service and the MenuCommand class. /// </summary> private void ShowToolWindow(object sender, EventArgs e) { try { object o = GetService(typeof(IVsTeamFoundationBuild)); IVsTeamFoundationBuild tfsBuild = o as IVsTeamFoundationBuild; // Get the instance number 0 of this tool window. This window is single instance so this instance // is actually the only one. // The last flag is set to true so that if the tool window does not exists it will be created. ToolWindowPane window = this.FindToolWindow(typeof(MyToolWindow), 0, true); if ((null == window) || (null == window.Frame)) { throw new NotSupportedException(Resources.CanNotCreateWindow); } MyToolWindow myWindow = (MyToolWindow)window; MyControl myControl = (MyControl)myWindow.Content; myControl.Package = this; myControl.TfsBuild = tfsBuild; IVsWindowFrame windowFrame = (IVsWindowFrame)window.Frame; Microsoft.VisualStudio.ErrorHandler.ThrowOnFailure(windowFrame.Show()); } catch (Exception ex) { ActivityLog.LogError("PowerDeliveryVSExtension2012", string.Format("Message: {0} Stack: {1}", ex.Message, ex.StackTrace)); } }
public TFSBuildService(ITFSConnection _tfsConnection, IServiceProvider serviceProvider, ILogger _logger) { tfsConnection = _tfsConnection; tfsConnection.ConnectionChanged += ResetConnection; logger = _logger; teamExplorer = serviceProvider.GetService(typeof(ITeamExplorer)) as ITeamExplorer; vsTfsBuild = serviceProvider.GetService(typeof(IVsTeamFoundationBuild)) as IVsTeamFoundationBuild; }
public VSExtensionContext(TeamFoundationServerExt ext, IVsTeamFoundationBuild buildExt) { this.ext = ext; this.buildExt = buildExt; if (ext != null) { this.currentConnectionUri = ext.ActiveProjectContext.DomainUri; ext.ProjectContextChanged += this.OnSelectedProjectChanged; } }
public void InitializeExtension(TeamFoundationServerExt ext, IVsTeamFoundationBuild buildExt) { this.ctx = new VSExtensionContext(ext, buildExt); this.ctx.ProjectChanged += this.OnProjectChanged; this.ChangeConnection(); }
public VsTeamFoundationBuildWrapper(IVsTeamFoundationBuild vsTeamFoundationBuild) { _vsTeamFoundationBuild = vsTeamFoundationBuild; _buildExplorerWrapper = new Lazy<BuildExplorerWrapper>(() => new BuildExplorerWrapper(_vsTeamFoundationBuild.BuildExplorer)); }
public VsTeamFoundationBuildWrapper(IVsTeamFoundationBuild vsTeamFoundationBuild) { _vsTeamFoundationBuild = vsTeamFoundationBuild; _buildExplorerWrapper = new Lazy <BuildExplorerWrapper>(() => new BuildExplorerWrapper(_vsTeamFoundationBuild.BuildExplorer)); }