public void OnRemoveBuildProcessTemplate()
        {
            try
            {
                var items     = this.view.SelectedBuildProcessTemplates.ToList();
                var projects  = this.repository.AllTeamProjects.Select(tp => tp.Name).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);
            }
        }
Exemplo n.º 2
0
        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);
            }
        }
Exemplo n.º 3
0
        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);
            }
        }