I'm using the IASToolkit to create an interactive UI for a low-code app. I want to disable the button on pressed to avoid people pushing it multiple times and to indicate that the action linked to the button is running. I was looking into triggering the Update method after setting the IsEnabled property, but that is only allowed in manual mode. I didn't find a lot of information on how the manual mode should be used. When running the script from the Automation application, everything seems to be disabled by default.
What is the easiest/best way to achieve this?
Hi Michiel,
I've pushed an example to github: DisabledWhenPressed
The solution is to call Show(false); in your dialog class whenever you want the visuals to get updated, but haven't finished processing your event.
Note, by default, Show(); will use true as input, which means a response is required and prevents further Show calls from working.
With thanks to Thomas Cauwelier for explaining why the Show() wasn't working for me initially.
Hi Michiel
Would it be an option to do something like this?
private void OnPressed(object sender, EventArgs e)
{
Button.IsEnabled = false;// Method body
Button.IsEnabled = true;
}
Setting the IsEnabled property to false causes the widget to be grayed out and disables user interaction.
I tried this, but it does not seem to work (at least from the low-code app). The behavior is different when triggering the IAS from the automation module. I just tested disabling the button and it looks like it completely doesn’t work from low-code apps. So begins to look more like a bug.
Are you using the latest stable version of the IASToolkit NuGet (6.1.0)?
https://www.nuget.org/packages/Skyline.DataMiner.Utils.InteractiveAutomationScriptToolkit/6.1.0
I think the enabled/disabled doesn’t update the display, and it will probably resolve after exiting the current function. There’s similar behaviour in WinForms. Will try to check my theory against a script locally and see if I can find a solution.
Thanks Floris,
The example really helps to quickly understand it!