protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); using (var picker = new TeamProjectPicker(TeamProjectPickerMode.SingleProject, false)) { var result = picker.ShowDialog(); if (result != DialogResult.OK) { return; } var tpc = picker.SelectedTeamProjectCollection; tpc.Authenticate(); var store = tpc.GetService<WorkItemStore>(); var project = store.Projects.Cast<Project>().First(_ => _.Name == picker.SelectedProjects[0].Name); MainWindow = new MainWindow { DataContext = new LinqCodeGenerationViewModel(project) }; MainWindow.Show(); } }
public async void ConnectUI() { await Task.Run(() => { this.IsConnecting = true; try { TeamProjectPicker tpp = new TeamProjectPicker(TeamProjectPickerMode.SingleProject, false); tpp.ShowDialog(); if (tpp.SelectedTeamProjectCollection != null) { Tpc = tpp.SelectedTeamProjectCollection; Tpc.EnsureAuthenticated(); TeamProjects = tpp.SelectedProjects; this.workflowManagerStorage.LastTFSConnection = new TFSConnectionDetails() { Uri = Tpc.Uri.ToString(), Project = TeamProjects.First().Name }; this.RaisePropertyChanged(() => this.IsConnected); } } catch (Exception ex) { this.eventAggregator.GetEvent<ShowMessageEvent>().Publish("#MsgCannotConnectTFS"); } this.IsConnecting = false; }); }
public static bool TryGetTeamProjectCollection(string localPath, ref Uri tfsName, out string tfsFolder) { tfsFolder = null; if (tfsName == null) { var projectCollections = RegisteredTfsConnections.GetProjectCollections(); if (projectCollections != null && projectCollections.Length == 1) { tfsName = projectCollections[0].Uri; } else { using (var dlg = new TeamProjectPicker(TeamProjectPickerMode.NoProject, false)) { dlg.AcceptButtonText = "Select"; if (dlg.ShowDialog() != DialogResult.OK) { return false; } tfsName = dlg.SelectedTeamProjectCollection.Uri; } } } var workspace = GetWorkspace(tfsName, localPath); if (workspace == null || !workspace.IsLocalPathMapped(localPath)) { return false; } tfsFolder = workspace.GetServerItemForLocalItem(localPath); return true; }
protected override void CreateChildControls() { var config = (TfsConfigurer)this.GetExtensionConfigurer(); this.txtArtifactName = new ValidatingTextBox { DefaultText = "Same as project name" }; this.txtTeamProject = new TeamProjectPicker(config); this.txtBuildDefinition = new BuildDefinitionPicker(config); this.txtTeamProject.SelectedIndexChanged += (s, e) => { this.txtBuildDefinition.TeamProject = this.txtTeamProject.SelectedValue; }; this.ddlBuildNumber = new DropDownList { Items = { new ListItem("allow selection at build time", string.Empty), new ListItem("last succeeded build", "success"), new ListItem("last completed build", "last") } }; this.txtBuildNumberPattern = new ValidatingTextBox { Text = "_(?<num>[^_]+)$" }; this.Controls.Add( new SlimFormField("Artifact name:", this.txtArtifactName), new SlimFormField("Team project:", this.txtTeamProject), new SlimFormField("Build definition:", txtBuildDefinition), new SlimFormField("Build number:", this.ddlBuildNumber), new SlimFormField("Capture pattern:", this.txtBuildNumberPattern) { HelpText = "When importing a build, you can opt to use the TFS build number; however, because TFS build numbers " + "can be 1,000 characters (or more), up to 10 characters must be extracted to fit the BuildMaster build number " + "using a Regex capture group named \"num\". The default TFS Build Number Format is $(BuildDefinitionName)_$(Date:yyyyMMdd)$(Rev:.r); " + " and thus the pattern _(?<num>[^_]+)$ will extract the date and revision." } ); }
public void SelectTfsProject() { var tfsPp = new TeamProjectPicker(TeamProjectPickerMode.SingleProject, false, new UICredentialsProvider()); tfsPp.ShowDialog(); if (tfsPp.SelectedTeamProjectCollection != null) { selectTfsProject(tfsPp.SelectedTeamProjectCollection.Uri.AbsoluteUri, tfsPp.SelectedProjects[0].Name); } }
private void btn_server_Click(object sender, RoutedEventArgs e) { btn_delete.IsEnabled = false; TeamProjectPicker pp = new TeamProjectPicker(TeamProjectPickerMode.SingleProject, false); pp.ShowDialog(); if (pp.SelectedTeamProjectCollection != null) { pp.SelectedTeamProjectCollection.EnsureAuthenticated(); store = (WorkItemStore)pp.SelectedTeamProjectCollection.GetService(typeof(WorkItemStore)); btn_delete.IsEnabled = true; } }
private void button1_Click(object sender, EventArgs e) { TeamProjectPicker tpp = new TeamProjectPicker(TeamProjectPickerMode.MultiProject, false); if (tpp.ShowDialog() == System.Windows.Forms.DialogResult.OK) { tpc = tpp.SelectedTeamProjectCollection; projects = tpp.SelectedProjects; toolStripStatusLabel1.Text = string.Format("Connected to: [{0}]", tpc.Uri.ToString()); } css = tpc.GetService<ICommonStructureService>(); FillProjects(); }
/// <summary> /// Method to connect to the TFS project /// </summary> /// <param name="sender">Event sender</param> /// <param name="e">Event arguments</param> private void ConnectButton_Click(object sender, RoutedEventArgs e) { TeamProjectPicker tpp = new TeamProjectPicker(TeamProjectPickerMode.SingleProject, false); var result = tpp.ShowDialog(); if (result == System.Windows.Forms.DialogResult.OK) { this.tfs = tpp.SelectedTeamProjectCollection; this.teamProject = tpp.SelectedProjects[0].Name; TFSProject.Text = this.teamProject; WorkItem.IsEnabled = true; ExecuteButton.IsEnabled = true; ITestManagementService test_service = (ITestManagementService)this.tfs.GetService(typeof(ITestManagementService)); this.testManagementTeamProject = test_service.GetTeamProject(tpp.SelectedProjects[0].Name); } }
public TfsTeamProjectCollection ConnectToTfs(out string selectedProject) { TfsTeamProjectCollection tpc = null; var tfsPP = new TeamProjectPicker(TeamProjectPickerMode.SingleProject, false); tfsPP.ShowDialog(); if (null != tfsPP.SelectedProjects) { tpc = tfsPP.SelectedTeamProjectCollection; selectedProject = tfsPP.SelectedProjects[0].Name; } else { selectedProject = ""; } return tpc; }
private void Button_Click_1( object sender, RoutedEventArgs e ) { listProjectNames.Items.Clear(); //"using" pattern is recommended as the picker needs to be disposed of using ( TeamProjectPicker tpp = new TeamProjectPicker( TeamProjectPickerMode.MultiProject, false ) ) { var result = tpp.ShowDialog(); if ( result == System.Windows.Forms.DialogResult.OK ) { textBlockServerName.Text = tpp.SelectedTeamProjectCollection.Name; foreach ( ProjectInfo projectInfo in tpp.SelectedProjects ) { listProjectNames.Items.Add( projectInfo.Name ); } } } }
public ITaskProject ConnectToProject(Window window) { using (var tpp = new TeamProjectPicker(TeamProjectPickerMode.SingleProject, false)) { var windowWrapper = new WindowWrapper(new System.Windows.Interop.WindowInteropHelper(window).Handle); var result = tpp.ShowDialog(windowWrapper); if (result == DialogResult.OK) { var tfs2010Project = new TfsProject(); tfs2010Project.projInfo = tpp.SelectedProjects[0]; tfs2010Project.workItemStoreService = tpp.SelectedTeamProjectCollection.GetService<WorkItemStore>(); // Get work item types tfs2010Project.wiTypes = tfs2010Project.workItemStoreService.Projects[tfs2010Project.projInfo.Name].WorkItemTypes; return tfs2010Project; } } return null; }
public frmMain() { InitializeComponent(); TeamProjectPicker projectPicker = new TeamProjectPicker(); var userSelected = projectPicker.ShowDialog(); if (userSelected == DialogResult.Cancel) { return; } if (projectPicker.SelectedTeamProjectCollection != null) { Uri tfsUri = projectPicker.SelectedTeamProjectCollection.Uri; string teamProjectName = projectPicker.SelectedProjects[0].Name; selectedProjectCollection = projectPicker.SelectedTeamProjectCollection; this.Text = selectedProjectCollection.DisplayName; } }
private void OnLoaded(object sender, RoutedEventArgs e) { try { using (TeamProjectPicker tpp = new TeamProjectPicker(TeamProjectPickerMode.SingleProject, false)) { System.Windows.Forms.DialogResult result = tpp.ShowDialog(); if (result == System.Windows.Forms.DialogResult.OK) { var context = new AppTfsContext(tpp.SelectedTeamProjectCollection, tpp.SelectedProjects.First()); this.MainView.InitializeContext(context); this.MainView.InitializeRepository(new TfsClientRepository(tpp.SelectedTeamProjectCollection)); } } } catch (Exception ex) { MainWindow.DisplayError(ex); } }
/// <summary> /// Load project settings from TFS team project picker. /// </summary> /// <param name="projectPicker">The project picker.</param> public void LoadProjectSettingsFromUserDecision(TeamProjectPicker projectPicker, ref TfsTeamProjectCollection tfsTeamProjectCollection, ref ITestManagementTeamProject testManagementTeamProject, ref Preferences preferences, ITestManagementService testService, string selectedTestPlan, bool writeToRegistry = true) { preferences = new Preferences(); log.Info("Load project info depending on the user choice from project picker!"); try { using (projectPicker) { var userSelected = projectPicker.ShowDialog(); if (userSelected == DialogResult.Cancel) { return; } if (projectPicker.SelectedTeamProjectCollection != null) { preferences.TfsUri = projectPicker.SelectedTeamProjectCollection.Uri; log.InfoFormat("Picker: TFS URI: {0}", preferences.TfsUri); preferences.TestProjectName = projectPicker.SelectedProjects[0].Name; log.InfoFormat("Picker: Test Project Name: {0}", preferences.TestProjectName); tfsTeamProjectCollection = projectPicker.SelectedTeamProjectCollection; log.InfoFormat("Picker: TfsTeamProjectCollection: {0}", tfsTeamProjectCollection); testService = (ITestManagementService)tfsTeamProjectCollection.GetService(typeof(ITestManagementService)); testManagementTeamProject = testService.GetTeamProject(preferences.TestProjectName); } log.InfoFormat("Test Project Name: {0}", preferences.TestProjectName); log.InfoFormat("TFS URI: {0}", preferences.TfsUri); if (writeToRegistry) { RegistryManager.Instance.WriteCurrentTeamProjectName(preferences.TestProjectName); RegistryManager.Instance.WriteCurrentTeamProjectUri(preferences.TfsUri.ToString()); } } } catch (Exception ex) { ModernDialog.ShowMessage("Error selecting team project.", "Warning", MessageBoxButton.OK); log.Error("Project info not selected.", ex); } }
public BuildDefinitionUpdater() { try { TeamProjectPicker tpp = new TeamProjectPicker(TeamProjectPickerMode.SingleProject, false); tpp.ShowDialog(); if (tpp.SelectedTeamProjectCollection != null) { tfpCollection = tpp.SelectedTeamProjectCollection; tfpCollection.EnsureAuthenticated(); selectedProject = tpp.SelectedProjects[0].Name; buildServer = (IBuildServer)tfpCollection.GetService(typeof(IBuildServer)); } } catch (Exception pokeballExc) { LogExc(pokeballExc); } }
private void btnTeamProjectPicker_Click(object sender, EventArgs e) { TfsTeamProjectCollection tpc; using (var picker = new TeamProjectPicker(TeamProjectPickerMode.SingleProject, false)) { var result = picker.ShowDialog(); if (result == DialogResult.OK) { tpc = picker.SelectedTeamProjectCollection; Options.TfsServerUrl = tpc.Uri.ToString(); txtTfsUrl.Text = Options.TfsServerUrl; Options.TfsProject = picker.SelectedProjects[0].Name; txtTfsProject.Text = Options.TfsProject; var tfs = picker.SelectedTeamProjectCollection; var projInfo = picker.SelectedProjects[0]; var store = tfs.GetService<WorkItemStore>(); BuildQueryHierarchy(projInfo, store.Projects[projInfo.Name].QueryHierarchy); } } }
public async void OpenTeamProjectPicker(bool source) { var tpp = new TeamProjectPicker(TeamProjectPickerMode.SingleProject, false); if (tpp.ShowDialog() == System.Windows.Forms.DialogResult.OK && tpp.SelectedTeamProjectCollection != null && tpp.SelectedProjects.Any()) { if (source) { string tfsUrl = tpp.SelectedTeamProjectCollection.Uri.AbsoluteUri; Settings.Default.SourceTFS = tfsUrl; string projectName = tpp.SelectedProjects[0].Name; Settings.Default.SourceProject = projectName; Settings.Default.Save(); await Connect(tfsUrl, projectName, true, false); Connected(this, new ConnectionArgs() { IsSource = true, Success = true }); } else { string tfsUrl = tpp.SelectedTeamProjectCollection.Uri.AbsoluteUri; Settings.Default.TargetTFS = tfsUrl; string projectName = tpp.SelectedProjects[0].Name; Settings.Default.TargetProject = projectName; Settings.Default.Save(); await Connect(tfsUrl, projectName, false, Settings.Default.BypassRules); Connected(this, new ConnectionArgs() { IsSource = false, Success = true }); } } else { Connected(this, new ConnectionArgs() { IsSource = source, Success = false }); } }
/// <summary> /// Opens the Common TFS Project Selection Form. /// </summary> /// <returns></returns> public static ITestManagementTeamProject SelectTfsProject(bool isDestinationProject) { TeamProjectPicker teamProjectPicker = new TeamProjectPicker(TeamProjectPickerMode.SingleProject, false); DialogResult result = teamProjectPicker.ShowDialog(); if (result == DialogResult.OK && teamProjectPicker.SelectedTeamProjectCollection != null) { if (isDestinationProject && teamProjectPicker.SelectedTeamProjectCollection != null) { TfsTeamProjectCollection destinationTeamProjectCollection = teamProjectPicker.SelectedTeamProjectCollection; destinationTeamProjectCollection.Connect(ConnectOptions.IncludeServices); _destinationStructureService = destinationTeamProjectCollection.GetService(typeof(ICommonStructureService)) as ICommonStructureService; } TfsTeamProjectCollection teamProjectCollection = teamProjectPicker.SelectedTeamProjectCollection; ITestManagementService testManagementService = (ITestManagementService)teamProjectCollection.GetService(typeof(ITestManagementService)); ITestManagementTeamProject project = testManagementService.GetTeamProject(teamProjectPicker.SelectedProjects[0].Name); return project; } return null; }
private void btn_connect_Click(object sender, RoutedEventArgs e) { this._tfs = null; Sel_TPlan.Items.Clear(); treeView_suite.Items.Clear(); TFS_Textbox.Text = null; TeamProjectPicker tpp = new TeamProjectPicker(TeamProjectPickerMode.SingleProject, false); tpp.ShowDialog(); if (tpp.SelectedTeamProjectCollection != null) { this._tfs = tpp.SelectedTeamProjectCollection; ITestManagementService test_service = (ITestManagementService)_tfs.GetService(typeof(ITestManagementService)); _store = (WorkItemStore)_tfs.GetService(typeof(WorkItemStore)); TFS_Textbox.Text = this._tfs.Name; string proj_name = tpp.SelectedProjects[0].Name; _testproject = test_service.GetTeamProject(proj_name); if (_testproject != null) { TFS_Textbox.Text = TFS_Textbox.Text + "\\" + _testproject.ToString(); GetTestPlans(_testproject); } else MessageBox.Show("Please select a valid Team Project"); } }
/// <summary> /// Handles the Click event of the BrowseButton control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="RoutedEventArgs"/> instance containing the event data.</param> private void BrowseButton_Click(object sender, RoutedEventArgs e) { var projectPicker = new TeamProjectPicker(TeamProjectPickerMode.SingleProject, false); this.ProjectSelectionViewModel.LoadProjectSettingsFromUserDecision(projectPicker); this.ProjectSelectionViewModel.InitializeTestPlans(ExecutionContext.TestManagementTeamProject); }
public void SelectServer() { var picker = new TeamProjectPicker(TeamProjectPickerMode.SingleProject, false, new UICredentialsProvider()); if (picker.ShowDialog() == System.Windows.Forms.DialogResult.OK) { SelectedServerUri = picker.SelectedTeamProjectCollection.Uri.ToString(); SelectedProjectName = picker.SelectedProjects[0].Name; TfsService = new TfsService(new Uri(SelectedServerUri)); RefreshBuildDefinitions(); } }
private void buttonConnect_Click(object sender, EventArgs e) { button_save.Enabled = false; using (TeamProjectPicker tpp = new TeamProjectPicker(TeamProjectPickerMode.SingleProject, false)) { DialogResult result = tpp.ShowDialog(); if (result == DialogResult.OK) { textbox_tfsUrl.Text = tpp.SelectedTeamProjectCollection.Uri.ToString(); textbox_defaultProject.Text = tpp.SelectedProjects[0].Name; button_save.Enabled = true; BackgroundForm backgroundForm = BackgroundForm.ShowAndWait(TFSPlugin.Attributes.Name, Language.GetString("tfs",LangKey.communication_wait)); try { this.BindScreen(); } finally { backgroundForm.CloseDialog(); } } } }
/// <summary> /// Show the TFS Dialog Picker to selected a project in a project collection /// </summary> public void ShowDialog() { TeamProjectPicker tfsDialog = new TeamProjectPicker(TeamProjectPickerMode.SingleProject, false); if (tfsDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) { this.ProjectCollection = tfsDialog.SelectedTeamProjectCollection; if (tfsDialog.SelectedProjects.Any()) { this.ProjectName = tfsDialog.SelectedProjects[0].Name; } } }
/// <summary> /// Load project settings from TFS team project picker. /// </summary> /// <param name="projectPicker">The project picker.</param> public void LoadProjectSettingsFromUserDecision(TeamProjectPicker projectPicker) { base.LoadProjectSettingsFromUserDecision(projectPicker, ref this.tfsTeamProjectCollection, ref this.testManagementTeamProject, ref this.preferences, this.tfsClientService, this.SelectedTestPlan); ExecutionContext.TfsTeamProjectCollection = this.tfsTeamProjectCollection; ExecutionContext.TestManagementTeamProject = this.testManagementTeamProject; ExecutionContext.Preferences = this.preferences; this.FullTeamProjectName = base.GenerateFullTeamProjectName(ExecutionContext.Preferences.TfsUri.ToString(), ExecutionContext.Preferences.TestProjectName); }
/// <summary> /// Handles the Click event of the btnDestinationBrowser control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="RoutedEventArgs"/> instance containing the event data.</param> private void btnDestinationBrowser_Click(object sender, RoutedEventArgs e) { var projectPicker = new TeamProjectPicker(TeamProjectPickerMode.SingleProject, false); this.TestCasesMigrationViewModel.LoadProjectSettingsFromUserDecisionDestination(projectPicker); }
public TeamProjectPickerAdapter() { this.tpp = new TeamProjectPicker(TeamProjectPickerMode.SingleProject, false); }
public TfsWrapper() { TeamProjectPicker tfsPP = new TeamProjectPicker(TeamProjectPickerMode.SingleProject, false); tfsPP.ShowDialog(); _tfs = tfsPP.SelectedTeamProjectCollection; _selectedTeamProject = tfsPP.SelectedProjects[0].Name; _bs = _tfs.GetService<IBuildServer>(); }
/// <summary> /// 手动更改TFS项目 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void toolStripMenuItem1_Click(object sender, EventArgs e) { string tpcURL=Util.GetConfiguration("tpcURL"); string project=Util.GetConfiguration("project"); if (MessageBox.Show("当前TFS项目已配置为:"+tpcURL+"/"+project+",要更改为其它项目吗?", "确认", MessageBoxButtons.OKCancel, MessageBoxIcon.Question,MessageBoxDefaultButton.Button1) == DialogResult.OK) { //弹出TFS连接 TeamProjectPicker tpp = new TeamProjectPicker(TeamProjectPickerMode.SingleProject, false); if (tpp.ShowDialog() == DialogResult.OK) { //获取所选择的团队项目集合 TfsTeamProjectCollection selectedColl = tpp.SelectedTeamProjectCollection; if (selectedColl != null) { Util.SetConfiguration("tpcURL", selectedColl.Uri.ToString()); } //获得选择的团队项目 ProjectInfo[] projects = tpp.SelectedProjects; if(projects.Length>0) { Util.SetConfiguration("project", projects[0].Name); } } } }
/// <summary> /// Adds a new Server/Project Collection to the list of registered servers on the /// local machine and then re-binds the combobox to the list of registered servers /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnAdd_Click(object sender, RoutedEventArgs e) { TeamProjectPicker tpp = new TeamProjectPicker(TeamProjectPickerMode.NoProject, false); tpp.ShowDialog(); LoadRegisteredServers(); }
private void ConnectSourceProjectButton_Click(object sender, RoutedEventArgs e) { TeamProjectPicker tpp = new TeamProjectPicker(TeamProjectPickerMode.SingleProject, false); DialogResult result = tpp.ShowDialog(); if (result.ToString() == "OK") { StatusViwer.Content = ""; MigratingLabel.Content = ""; StatusBar.Value = 0; SourceFieldGrid.ItemsSource = new List<string>(); TargetFieldGrid.ItemsSource = new List<string>(); MappedListGrid.ItemsSource = new List<object>(); FieldToCopyGrid.ItemsSource = new List<object>(); WorkFlowListGrid.ItemsSource = new List<object>(); finalFieldMap = new Hashtable(); copyingFieldSet = new Hashtable(); migrateTypeSet = new List<object>(); sourceTFS = tpp.SelectedTeamProjectCollection; sourceStore = (WorkItemStore)sourceTFS.GetService(typeof(WorkItemStore)); sourceProject = sourceStore.Projects[tpp.SelectedProjects[0].Name]; SourceProjectText.Text = string.Format("{0}/{1}", sourceTFS.Uri.ToString(), sourceProject.Name); readSource = new WorkItemRead(sourceTFS, sourceProject); if ((string)ConnectionStatusLabel.Content == "Select a Source project") { ConnectionStatusLabel.Content = ""; } } }