VS2012 TFS2012
I followed this simple guide to create drop down menu in build definition. My goal is to have two drop downs, one with 20 selections and being able to select multiple options, second with 70 and pick only one.
After adding more than two options to enum, selecting and deselecting doesn't work properly. For example:
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
}
}
I select Another and Internal deselects , and Public and Failed selects. With each click I get different combination of selected\unselected options.
EDIT: Adding pictures Open DropDown Only Internal2 is selected(TOO low rep to post more than 2 links) Clicked Another link Now 3 Are selected.
Refer to other post for answer.
What I end up doing is something like this: custom type for an argument
I needed to get data XML. For multiple selection I used dynamic checkboxes that were created from xml sections. For single selection I went with combobox.
Important Note. To actually make this work and Build read data U need to change
return value;
to
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};
}