public SelectTeamProject(TeamProjectListViewModel model, string selectedTeamProject) { this.model = model; this.InitializeComponent(); this.Grid1.DataContext = this.model; if (selectedTeamProject != null) { var project = model.TeamProjects.FirstOrDefault(tp => tp.Name == selectedTeamProject); if (project != null) { this.BuildControllerList.SelectedValue = project; } } }
public void OnRemoveBuildProcessTemplate() { try { var items = this.view.SelectedBuildProcessTemplates.ToList(); var projects = this.repository.AllTeamProjects.Select(tp => tp).ToList(); var viewModel = new TeamProjectListViewModel(projects); var wnd = new SelectTeamProject(viewModel, this.view.SelectedTeamProject) { cbSetAsDefault = { Visibility = Visibility.Collapsed } }; bool? res = wnd.ShowDialog(); if (res.HasValue && res.Value) { using (new WaitCursor()) { this.repository.RemoveBuildProcessTemplates(items.Select(pt => pt.ServerPath), wnd.SelectedTeamProjects.Select(tp => tp.Name), this.ShouldRemove); this.OnRefresh(new EventArgs()); } this.OnRefresh(new EventArgs()); } } catch (Exception ex) { this.view.DisplayError(ex); } }
private void OnCloneBuildToProject() { try { var items = this.view.SelectedItems.ToList(); if (items.Count() != 1) { return; } var item = items.First(); using (new WaitCursor()) { var projects = this.repository.AllTeamProjects.Select(tp => tp).ToList(); var viewModel = new TeamProjectListViewModel(projects); var wnd = new SelectTeamProject(viewModel, this.view.SelectedTeamProject) { cbSetAsDefault = { Visibility = Visibility.Collapsed } }; bool? res = wnd.ShowDialog(); if (res.HasValue && res.Value) { using (new WaitCursor()) { string targetProject = wnd.SelectedTeamProjects.Select(tp => tp.Name).First(); if (item.BuildDefinition.TeamProject == targetProject) { item.Name = item.Name + "_" + DateTime.Now.ToString("F").Replace(":", "-"); } this.repository.CloneBuildToProject(item.Uri, item.Name, targetProject); } this.OnRefresh(new EventArgs()); } } } catch (Exception ex) { this.view.DisplayError(ex); } }