TFS构建定义下拉菜单

时间:2016-01-22 16:25:26

标签: tfs2012 tfsbuild build-definition

VS2012 TFS2012

我按照this简单指南在构建定义中创建下拉菜单。我的目标是有两个下拉菜单,一个有20个选项,可以选择多个选项,第二个是70,只挑一个。

在枚举中添加两个以上选项后,选择和取消选择无法正常工作。例如:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Workflow.ActivityHelpers
{
public enum Enums
    {

        Internal,
        Public,
        Failed,
        Another,
        YetAnother
    }
}

我选择了Another and Internal deselects,以及Public和Failed选择。每次单击,我都会得到选定的\未选择的选项的不同组合。

编辑: 添加图片 打开DropDown 仅选择Internal2(TOO低rep以发布超过2个链接) 点击另一个 link 现在3被选中。

请参阅其他帖子以获得答案。

2 个答案:

答案 0 :(得分:0)

指南正在使用“if ... then ... else”。这适合两种选择。请更改为正确的代码。并确保可以支持多种选择的变量类型。

答案 1 :(得分:0)

我最终做的是这样的: custom type for an argument

我需要获取数据XML。对于多个选择,我使用了从xml部分创建的动态复选框。对于单一选择,我选择了combobox。

重要说明。要实际完成这项工作并构建读取数据,需要更改

返回值;

 class CredentialEditor : UITypeEditor 
{ 

    public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) 
    { 
        string selected = null;
        if (provider != null) 
        { 
            IWindowsFormsEditorService editorService = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); 

            if (editorService != null) 
            { 
                Credential credential = value as Credential; 

                using (CredentialDialog dialog = new CredentialDialog()) 
                { 
                    dialog.UserName = credential.UserName; 
                    dialog.Password = credential.Password; 

                    if (editorService.ShowDialog(dialog) == DialogResult.OK) 
                    { 
                        credential.UserName = dialog.UserName; 
                        credential.Password = dialog.Password; 
                        selected = dialog.UserName
                    } 
                } 
            } 

        } 

        return new Credentials() { UserName = selected}; 

    }