I would like to display different values in the Input Channel dropdown depending on the value the user selects in the Input Type dropdown. So far I am able to get the data the user selects after clicking EDIT, but the idea is to be able to select the Input Type selection and Input channel changes without clicking the button.
Thank you.
Hi Gina
Would it be an option to implement something like this in the event handler of the Input Type dropdown?
The following pieces of code use the InteractiveAutomationScriptToolkit NuGet package version 6.1.0 (NuGet Gallery | Skyline.DataMiner.Utils.InteractiveAutomationScriptToolkit 6.1.0).
Note that the InteractiveAutomationScriptToolkit package has a dependency on the DataMiner Automation Development NuGet package version >= 10.3.1 (NuGet Gallery | Skyline.DataMiner.Dev.Automation 10.3.1.1).
// To make this script interactive "engine.ShowUI()" must be mentioned somewhere (in code or in comment) in this file.
// Be aware, removing this indication will break the script!.Skyline.DataMiner.Utils.InteractiveAutomationScript.InteractiveController interactiveController = new InteractiveController(engine);
ChannelDialog channelDialog = new ChannelDialog(engine);
channelDialog.BuildDialog();// Uses the channelDialog as the first dialog.
interactiveController.Run(channelDialog);
// Uses the channelDialog as the second, third,... dialog.
// interactiveController.ShowDialog(channelDialog);
public class ChannelDialog : Skyline.DataMiner.Utils.InteractiveAutomationScript.Dialog
{
private Skyline.DataMiner.Utils.InteractiveAutomationScript.DropDown inputChannelDropDown;
private Skyline.DataMiner.Utils.InteractiveAutomationScript.DropDown inputTypeDropDown;private List<string> inputChannelOptions = new List<string>();
public ChannelDialog(IEngine engine) : base(engine)
{
}public void BuildDialog()
{
inputChannelDropDown = new DropDown
{
MinWidth = 200,
};inputTypeDropDown = new DropDown
{
MinWidth = 200,
};inputTypeDropDown.Changed += OnInputTypeChange;
AddWidget(inputTypeDropDown, 6, 1);
AddWidget(inputChannelDropDown, 7, 1);
}private void OnInputTypeChange(object sender, DropDown.DropDownChangedEventArgs e)
{
inputChannelOptions.Clear();
switch (inputTypeDropDown.Selected)
{
case "APIN":
inputChannelOptions.Add("A-3-1 Upmix (L)");
break;
}inputChannelDropDown.SetOptions(inputChannelOptions);
if (inputChannelOptions.Count > 0)
{
inputChannelDropDown.Selected = inputChannelOptions.First();
}
}
}
Hi Gina, the code uses the InteractiveAutomationScriptToolkit NuGet package. This package was built to quickly develop interactive automation scripts for DataMiner. I’ve updated my answer with some more details. Kind regards.
Hi Michiel, thank you for your answer. Can you show me how would you create the dropdowns variables ?
I’m using UIBlockDefinition to create them but I can’t find the methods Selected or SetOptions how you have in your example.
var inputTypeDropDown = new UIBlockDefinition { Type = UIBlockType.DropDown, InitialValue = “AAP”, DestVar = “1”, Row = 1, Column = 1, Width = 350 };
Thank you.