private void retryOperation_Click(object sender, RoutedEventArgs e) { if (Model != null && Model.Project != null) { CheckoutAndBuild2Package.GetGlobalService <MainLogic>().ExecuteService(Model.RequestedOperation, new [] { Model.Project }); } }
private string GetBatchScript(ISolutionProjectModel solutionProject, IServiceSettings settings) { if (solutionProject.ParentWorkingFolder == null) { var context = CheckoutAndBuild2Package.GetGlobalService <TfsContext>(); if (context.IsGitSourceControlled(solutionProject.ItemPath)) { string _s = Path.GetPathRoot(solutionProject.SolutionFolder).Replace("\\", string.Empty) + Environment.NewLine; _s += $"cd \"{solutionProject.SolutionFolder}\"" + Environment.NewLine; //_s += "git checkout master"; // TODO Mal richtig für git auschecken und branch ermitteln _s += "git pull"; return(_s); } return(string.Empty); } CheckTFExe(); CheckoutServiceSettings serviceSettings = settings.GetSettingsFromProvider <CheckoutServiceSettings>(solutionProject); var path = GetItemPath(solutionProject, serviceSettings, false); string s = Path.GetPathRoot(solutionProject.ParentWorkingFolder.LocalItem).Replace("\\", string.Empty); s += Environment.NewLine + $"cd \"{solutionProject.ParentWorkingFolder.LocalItem}\"" + Environment.NewLine; s += $"\"{tfExe}\" get \"{path}\" /recursive {GetFlags(serviceSettings)} "; return(s); }
private async void ExecuteScript(object o) { var cancellationToken = CreateCancellationToken(); using (new PauseCheckedActionScope(() => IsExecuting = true, () => IsExecuting = false, cancellationToken)) { if (ScriptHelper.IsPowerShell(FileName)) { ISolutionProjectModel[] models = CheckoutAndBuild2Package.GetGlobalService <MainViewModel>() .IncludedWorkingfolderModel.WorkingFolders.SelectMany(model => model.Projects.OfType <ISolutionProjectModel>()) .OrderBy(model => model.BuildPriority).ToArray(); var logic = CheckoutAndBuild2Package.GetGlobalService <MainLogic>(); var result = await Check.TryCatchAsync <Collection <PSObject>, TaskCanceledException>(logic.ExecutePowershellScriptAsync(FileName, null, models, cancellationToken).IgnoreCancellation(cancellationToken), cancellation : cancellationToken); Output.WriteLine("Script Result: " + result); } else { var result = await Check.TryCatchAsync <ScriptExecutingResult, TaskCanceledException>(ScriptHelper.ExecuteScriptAsync(FileName, string.Empty, ScriptExecutionSettings.Default, cancellationToken : cancellationToken).IgnoreCancellation(cancellationToken), cancellation : cancellationToken); Output.WriteLine("Script Result: " + result.ProcessResult); } } }
private void findChangeset(object sender, RoutedEventArgs e) { VersionControlExt vce = CheckoutAndBuild2Package.GetGlobalService <VersionControlExt>(); if (vce != null) { vce.FindChangeset(); } }
public void Close() { var model = CheckoutAndBuild2Package.GetGlobalService <MainViewModel>(); if (model != null && model.ExtraContent == this) { model.ExtraContent = null; } }
private ScriptExecutionSettings GetScriptExecutionSettings(bool requiresAdminPrivileges) { var unitTestServiceSettings = CheckoutAndBuild2Package.GetGlobalService <SettingsService>().GetSettingsFromProvider <UnitTestServiceSettings>(); ScriptExecutionSettings settings = unitTestServiceSettings.TrackLiveOutput ? ScriptExecutionSettings.Default : ScriptExecutionSettings.OneOutputStream; settings.RequiresAdminPrivileges = requiresAdminPrivileges; return(settings); }
public static IVsWindowFrame GetToolWindowFrame(Guid toolWindowId) { var shell = CheckoutAndBuild2Package.GetGlobalService <IVsUIShell>(); IVsWindowFrame testResultsFrame; var rguidPersistenceSlot = toolWindowId; shell.FindToolWindow((uint)__VSFINDTOOLWIN.FTW_fForceCreate, ref rguidPersistenceSlot, out testResultsFrame); return(testResultsFrame); }
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); } }
/// <summary> /// Initializes a new instance of the <see cref="T:System.Object"/> class. /// </summary> public ProjectViewModelProperties(ProjectViewModel project) { this.project = project; settingsService = CheckoutAndBuild2Package.GetGlobalService <SettingsService>(); testSettingsProvider = CheckoutAndBuild2Package.GetGlobalService <IDefaultTestSettingsProvider>(); BuildTargets = new NamedObservableCollection <string>(project.BuildTargets, "Build Targets"); BuildTargets.CollectionChanged += BuildTargetsOnCollectionChanged; BuildProperties = new NamedObservableCollection <BuildProperty>(project.BuildProperties.Select(pair => new BuildProperty(pair.Key, pair.Value)), "Build Properties"); BuildProperties.CollectionChanged += BuildPropertiesOnCollectionChanged; }
private void RegisterTeamProviders() { IServiceContainer service = CheckoutAndBuild2Package.GetGlobalService <CheckoutAndBuild2Package>(); if (service == null) { return; } service.RemoveService(typeof(List <ExportFactory <IConnectPageExtendedProjectInfoProvider, IConnectPageExtendedProjectInfoProviderData> >)); service.AddService(typeof(List <ExportFactory <IConnectPageExtendedProjectInfoProvider, IConnectPageExtendedProjectInfoProviderData> >), TeamProjectExtendedInfoProviders); }
private void Button_OnClick(object sender, RoutedEventArgs e) { Ignored = true; var span = TimeSpan.FromSeconds(1); label.BeginAnimation(OpacityProperty, new DoubleAnimation(1, new Duration(span))); button.BeginAnimation(OpacityProperty, new DoubleAnimation(0, new Duration(span))); Task.Delay(700).ContinueWith(task => { CheckoutAndBuild2Package.GetGlobalService <ITeamExplorer>().NavigateToPage(new Guid(TeamExplorerPageIds.Home), null); }, System.Threading.Tasks.TaskScheduler.FromCurrentSynchronizationContext()); }
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); } } }
private static UIElement GetUIElement(PropertyInfo propertyInfo, ISettingsProviderClass settingsProvider) { var settingsService = CheckoutAndBuild2Package.GetGlobalService <SettingsService>(); var attribute = propertyInfo.GetAttributes <SettingsPropertyAttribute>(false).First(); SettingsKey settingsKey = GetSettingsKey(propertyInfo, settingsProvider); object defaultValue = null; DefaultValueAttribute defaultValueAttribute = propertyInfo.GetAttributes <DefaultValueAttribute>(false).FirstOrDefault(); if (defaultValueAttribute != null) { defaultValue = defaultValueAttribute.Value; } return(EditorTemplates.GetUIElement(propertyInfo, settingsService, settingsKey, defaultValue, attribute)); }
public static bool IsIncluded(this IOperationService service, ISolutionProjectModel solutionProjectModel = null) { var settingsService = CheckoutAndBuild2Package.GetGlobalService <SettingsService>(); SettingsKey settingsKey = service.ServiceSettingsKey(); bool defaultValue = settingsService.Get(settingsKey, service.Order <= ServicePriorities.BuildServicePriority); if (solutionProjectModel != null) { settingsKey = service.ServiceSettingsKey(solutionProjectModel); } bool isIncluded = settingsService.Get(settingsKey, defaultValue); return(isIncluded); }
public static IVsPackage GetPackage(Guid packageId) { var shell = CheckoutAndBuild2Package.GetGlobalService <IVsShell>(); Guid testManageMentPackageId = packageId; int isInstalled; shell.IsPackageInstalled(testManageMentPackageId, out isInstalled); if (isInstalled != 1) { return(null); } IVsPackage res; shell.LoadPackage(packageId, out res); return(res); }
public void Initialize() { listBoxPlugins.Items.Clear(); linkLabel.Tag = linkLabel.Text = SettingsService.GetPluginDirectory(); UpdateLabel(); var plugins = CheckoutAndBuild2Package.GetGlobalService <CheckoutAndBuild2Package>().AggregateCatalog; foreach (DirectoryCatalog c in plugins.Catalogs.OfType <DirectoryCatalog>().Where(catalog => catalog.LoadedFiles.Any())) { var model = new PlugInModel(c.Path); if (!string.IsNullOrEmpty(model.Name) && model.Name != "de") { listBoxPlugins.Items.Add(model); } } }
private string GetPowershellScript(ISolutionProjectModel solutionProject, IServiceSettings settings) { var context = CheckoutAndBuild2Package.GetGlobalService <TfsContext>(); if (solutionProject.ParentWorkingFolder == null) { if (context.IsGitSourceControlled(solutionProject.ItemPath)) { string _s = Path.GetPathRoot(solutionProject.SolutionFolder).Replace("\\", string.Empty); return("git pull \"" + _s + "\""); } return(string.Empty); } CheckoutServiceSettings serviceSettings = settings.GetSettingsFromProvider <CheckoutServiceSettings>(solutionProject); CheckTFExe(); var builder = new StringBuilder() .AppendLine($"set-alias TFS \"{tfExe}\""); var tfsCollection = context.TeamProjectCollection.Uri; var path = GetItemPath(solutionProject, serviceSettings, true); if (ScriptExportProvider.IsTeamFoundationPowerShellSnapInInstalled) { var basePath = context.TfsContextManager.CurrentContext.TeamProjectName; //CheckoutServiceSettings serviceSettings = settings.GetSettingsFromProvider<CheckoutServiceSettings>(solutionProject); //var versionSpec = settingsService.Get(SettingsKeys.VersionSpecKey, VersionSpec.Latest); //string versionSpecStr = versionSpec == VersionSpec.Latest ? "Latest" : versionSpec.DisplayString; builder.AppendLine($"$tfsCollectionUrl = \"{tfsCollection}\"") .AppendLine($"$teamProjectBasePath = \"{basePath}\"") .AppendLine("$tfs=get-tfsserver $tfsCollectionUrl") .AppendLine("$vCS = $tfs.GetService([Microsoft.TeamFoundation.VersionControl.Client.VersionControlServer])") .AppendLine("$tfsProject = $vcs.GetTeamProject($teamProjectBasePath)") .AppendLine($"$workSpaceName = \"{context.SelectedWorkspace.Name}\"") .AppendLine("[Microsoft.TeamFoundation.VersionControl.Client.WorkSpace] $tfws = Get-TfsWorkspace -Server $tfs -Name $workSpaceName") .AppendLine($"$path=\"{path}\"") .AppendLine($"TFS get $path /recursive") .AppendLine($"TFS resolve $path /prompt"); return(builder.ToString()); } string flags = GetFlags(serviceSettings); builder.AppendLine($"& TFS get \"{path}\" {flags} /recursive"); return(builder.ToString()); }
public static CheckBox GetServiceSelector(this IOperationService service, ISolutionProjectModel solutionProjectModel = null) { SettingsKey settingsKey = service.ServiceSettingsKey(); if (solutionProjectModel != null) { settingsKey = service.ServiceSettingsKey(solutionProjectModel); } var settingsService = CheckoutAndBuild2Package.GetGlobalService <SettingsService>(); var isChecked = settingsService.Get(settingsKey, service.IsIncluded(solutionProjectModel)); var res = new CheckBox { Content = service.OperationName, IsChecked = isChecked, Tag = service }; res.Checked += (sender, args) => settingsService.Set(settingsKey, res.IsChecked ?? false); res.Unchecked += (sender, args) => settingsService.Set(settingsKey, res.IsChecked ?? false); return(res); }
private async void UpdateBuildDetail() { var tfsContext = CheckoutAndBuild2Package.GetGlobalService <TfsContext>(); if (tfsContext.BuildDetailManager.IsBackgroundBuildDefinitionLoadingEnabled && changeset != null) { BuildDetailVisibility = Visibility.Visible; TriggeredBuildDetail = await tfsContext.BuildDetailManager.FindBuildDetailForChangesetAsync(changeset); if (TriggeredBuildDetail != null) { TriggeredBuildDetail.StatusChanged += (sender, args) => RaisePropertyChanged(() => TriggeredBuildDetail); } } else { BuildDetailVisibility = Visibility.Collapsed; } }
private MsTestCommand GetTestCommand(ISolutionProjectModel projectViewModel, IServiceSettings settings, UnitTestInfo[] unitTestInfos, bool isScriptExport = false) { var settingsSrv = serviceProvider.Get <SettingsService>(); var tsp = CheckoutAndBuild2Package.GetGlobalService <IDefaultTestSettingsProvider>(); var unitTestServiceSettings = settingsSrv.GetSettingsFromProvider <UnitTestServiceSettings>(projectViewModel); var testSettingsFile = projectViewModel.EnsureAbsolutePath(settingsSrv.Get(projectViewModel.TestSettingsFileKey(), tsp != null ? tsp.GetTestSettingsFile(projectViewModel, settings) : String.Empty)); var command = new MsTestCommand(unitTestInfos) { RequiresAdminPrivileges = unitTestServiceSettings.RequiresAdminPrivileges, SpecifyEachTest = unitTestServiceSettings.TrackLiveOutput && !isScriptExport }; if (!string.IsNullOrEmpty(testSettingsFile) && File.Exists(testSettingsFile)) { command.DefaultTestSettings = testSettingsFile; } return(command); }
// Microsoft.TeamFoundation.Build.Client.GitHelper public static IEnumerable <GitRepository> GetGitRepositories() { List <GitRepository> result = new List <GitRepository>(); const string registryKey = @"Software\Microsoft\VisualStudio\{0}\TeamFoundation\GitSourceControl\Repositories\"; var dte = CheckoutAndBuild2Package.GetGlobalService <DTE2>(); string rootSuffix; IVsAppCommandLine vsAppCommandLine = CheckoutAndBuild2Package.GetGlobalService <IVsAppCommandLine>(); int pos; vsAppCommandLine.GetOption("rootsuffix", out pos, out rootSuffix); string currentStudioInfo = dte.Version + rootSuffix; using (var repoKey = Registry.CurrentUser.OpenSubKey(string.Format(registryKey, currentStudioInfo))) { if (repoKey != null) { foreach (string subKeyName in repoKey.GetSubKeyNames()) { using (var detailKey = repoKey.OpenSubKey(subKeyName)) { if (detailKey != null) { var name = detailKey.GetValue("Name"); var path = detailKey.GetValue("Path"); if (name != null && path != null) { var info = new GitRepository(name.ToString(), path.ToString()); if (!result.Contains(info)) { result.Add(info); } } } } } } } return(result); }
public static IEnumerable <WorkItem> AsWorkItems(this IEnumerable <object> elements) { var tfsContext = CheckoutAndBuild2Package.GetGlobalService <TfsContext>(); foreach (var element in elements) { if (element is WorkItem) { yield return(element as WorkItem); } if (element is Uri) { yield return(tfsContext.WorkItemManager.WorkItemStore.GetWorkItem(element as Uri)); } if (element is int) { yield return(tfsContext.WorkItemManager.WorkItemStore.GetWorkItem((int)element)); } if (element is WorkItemValueProvider) { yield return(((WorkItemValueProvider)element).WorkItem); } } }
public WorkItemsSectionView() { InitializeComponent(); tfsContext = CheckoutAndBuild2Package.GetGlobalService <TfsContext>(); workItemList.ContextMenuOpening += WorkItemListOnContextMenuOpening; }
public WorkSpaceSpecificOptionsPageControl() { InitializeComponent(); tfsContext = CheckoutAndBuild2Package.GetGlobalService <TfsContext>(); }
private void navigateToBuildsClick(object sender, RoutedEventArgs e) { CheckoutAndBuild2Package.GetGlobalService <ITeamExplorer>().NavigateToPage(TeamExplorerPageIds.Builds.ToGuid(), null); }
private void viewAllClick(object sender, RoutedEventArgs e) { CheckoutAndBuild2Package.GetGlobalService <VersionControlExt>().FindShelvesets(Section.UserContext.UserName, null); }
public void ShowMainSettingsPage() { //((DTE)CheckoutAndBuild2Package.GetGlobalService<SDTE>()).ExecuteCommand("Tools.Options", GuidList.mainOptionsPage); CheckoutAndBuild2Package.GetGlobalService <CheckoutAndBuild2Package>().ShowOptionPage(typeof(CheckoutAndBuildOptionsPage)); }
private void viewQueriesClick(object sender, RoutedEventArgs e) { TeamExplorerUtils.Instance.TryNavigateToWorkItems(CheckoutAndBuild2Package.GetGlobalService <CheckoutAndBuild2Package>()); }
/// <summary> /// Initializes a new instance of <see cref="T:Microsoft.VisualStudio.Shell.DialogPage"/>. /// </summary> public CheckoutAndBuildSectionOptionsPage() { settingsService = CheckoutAndBuild2Package.GetGlobalService <SettingsService>(); }
public CopySettingsControl() { InitializeComponent(); settingsService = CheckoutAndBuild2Package.GetGlobalService <SettingsService>(); }