///////////////////////////////////////////////////////////////////////////// // 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() { 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; VsTeamFoundationBuild tfsBuild = (VsTeamFoundationBuild)GetService(typeof(IVsTeamFoundationBuild)); MyControl myControl = (MyControl)myWindow.Content; myControl.Package = this; myControl.TfsBuild = tfsBuild; } }
private void ViewBuildDetail(object obj) { VsTeamFoundationBuild vsTfBuild = (VsTeamFoundationBuild)serviceProvider.Get <IVsTeamFoundationBuild>(); if (vsTfBuild != null) { vsTfBuild.DetailsManager.OpenBuild(SelectedBuildDetail.Uri); } }
private static void ViewBuildDefinition(IBuildDefinition definition) { VsTeamFoundationBuild vsTfBuild = (VsTeamFoundationBuild)Get <IVsTeamFoundationBuild>(); if (vsTfBuild != null) { vsTfBuild.DefinitionManager.OpenDefinition(definition.Uri); } }
private void viewAllClick(object sender, RoutedEventArgs e) { var tfs = CheckoutAndBuild2Package.GetGlobalService <TfsContext>(); VsTeamFoundationBuild vsTfBuild = CheckoutAndBuild2Package.GetGlobalService <VsTeamFoundationBuild>(); if (vsTfBuild != null) { vsTfBuild.BuildExplorer.CompletedView.Show(tfs.TfsContextManager.CurrentContext.TeamProjectName, string.Empty, string.Empty, DateFilter.All); } }
private void BuildList_OnMouseDoubleClick(object sender, MouseButtonEventArgs e) { var detail = buildList.SelectedItem as IBuildDetail; if (detail != null) { VsTeamFoundationBuild vsTfBuild = (VsTeamFoundationBuild)CheckoutAndBuild2Package.GetGlobalService <IVsTeamFoundationBuild>(); if (vsTfBuild != null) { vsTfBuild.DetailsManager.OpenBuild(detail.Uri); } } }
/// <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) { VsTeamFoundationBuild tfsBuild = (VsTeamFoundationBuild)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(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()); }
private static void ViewBuildDetails(IBuildDetail detail) { VsTeamFoundationBuild vsTfBuild = (VsTeamFoundationBuild)Get <IVsTeamFoundationBuild>(); vsTfBuild?.DetailsManager.OpenBuild(detail.Uri); }