コード例 #1
0
        public static IBuildAgent DialogShow(IBuildAgent agent, FormActionMode mode)
        {
            IBuildAgent result = null;

            if (form == null)
            {
                form = new FormAgentEdit();
            }

            form.agent = agent;
            form.mode  = mode;
            form.Initialize();

            if (form.ShowDialog() == DialogResult.OK)
            {
                if (form.mode != FormActionMode.View)
                {
                    result = new TempBuildAgent();
                    (result as TempBuildAgent).TeamProject = form.cmbTeamProject.SelectedItem as string;
                    result.Name        = form.edName.Text;
                    result.Description = form.edDescription.Text;
                    result.MachineName = form.edMachineName.Text;
                    //result.Port = Convert.ToInt32(form.edPort.Text);
                    result.RequireSecureChannel = form.chRequireSecureChannel.Checked;
                    result.BuildDirectory       = form.edBuildDirectory.Text;
                    result.Status = (AgentStatus)Enum.Parse(typeof(AgentStatus), form.cmbStatus.SelectedItem as string);
                    //result.MaxProcesses = (int) form.edMaxProcesses.Value;
                }
            }

            return(result);
        }
コード例 #2
0
        private void SelectBuildAgents(List <IBuildAgent> agents)
        {
            ListViewItem topItem = null;

            foreach (ListViewItem viewItem in this.lvAgents.Items)
            {
                var itemAgent = viewItem.Tag as IBuildAgent;

                ListViewItem item = viewItem;
                agents.ForEach(agent =>
                {
                    if (TempBuildAgent.IsEqual(agent, itemAgent))
                    {
                        if (topItem == null || item.Position.Y < topItem.Position.Y)
                        {
                            topItem = item;
                        }
                        item.Selected = true;
                        //item.Focused = true;
                    }
                });
            }

            if (topItem != null)
            {
                topItem.Focused = true;
                topItem.EnsureVisible();
            }
        }
コード例 #3
0
        private void mniAgent_Edit_Click(object sender, EventArgs e)
        {
            var buildAgent      = this.lvAgents.SelectedItems[0].Tag as IBuildAgent;
            var savedbuildAgent = new TempBuildAgent(buildAgent);

            IBuildAgent editedAgent = FormAgentEdit.DialogShow(buildAgent, FormActionMode.Edit);

            if (editedAgent != null)
            {
                TempBuildAgent.AssingTo(editedAgent, buildAgent);
                try
                {
                    Context.BuildServer.SaveBuildAgents(new[] { buildAgent });
                }
                catch (Exception ex)
                {
                    TempBuildAgent.AssingTo(savedbuildAgent, buildAgent);

                    MessageBox.Show(ex.Message, "Edit build agent", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                finally
                {
                    PopulateBuildAgents(true, true);
                    SelectBuildAgent(buildAgent);
                }
            }
        }
コード例 #4
0
ファイル: FormAgentCopyTo.cs プロジェクト: psulek/tfsman
        private void linkAgentDetails_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            IBuildAgent editedAgent = FormAgentEdit.DialogShow(this.newBuildAgent, FormActionMode.Edit);

            if (editedAgent != null)
            {
                TempBuildAgent.AssingTo(editedAgent, this.newBuildAgent);
            }
        }