diff --git a/InteractiveAutomationToolkit/Components/InteractiveWidget.cs b/InteractiveAutomationToolkit/Components/InteractiveWidget.cs index 1690055..47b7a55 100644 --- a/InteractiveAutomationToolkit/Components/InteractiveWidget.cs +++ b/InteractiveAutomationToolkit/Components/InteractiveWidget.cs @@ -45,6 +45,11 @@ protected internal string DestVar } } + /// + /// Gets a value indicating whether the block has interactivity features enabled. + /// + internal bool HasInteractivity => BlockDefinition.WantsOnChange || BlockDefinition.WantsOnFocusLost; + /// /// Load any changes made through user interaction. /// diff --git a/InteractiveAutomationToolkit/InteractiveController.cs b/InteractiveAutomationToolkit/InteractiveController.cs index d063cde..7bcb9c8 100644 --- a/InteractiveAutomationToolkit/InteractiveController.cs +++ b/InteractiveAutomationToolkit/InteractiveController.cs @@ -1,6 +1,7 @@ namespace Skyline.DataMiner.Utils.InteractiveAutomationScript { using System; + using System.Linq; using Skyline.DataMiner.Automation; @@ -176,7 +177,7 @@ private void Run(Dialog startDialog) else { SetScriptAbortPopupBehavior(CurrentDialog); - CurrentDialog.Show(); + CurrentDialog.Show(RequiresResponse(CurrentDialog)); } } } @@ -212,5 +213,21 @@ private void SetScriptAbortPopupBehavior(Dialog dialog) return; } } + + private bool RequiresResponse(Dialog dialog) + { + var interactiveWidgets = dialog.Widgets.OfType().ToList(); + if (interactiveWidgets.Count == 0) + { + return false; + } + + if (interactiveWidgets.Any(w => w.HasInteractivity)) + { + return true; + } + + return false; + } } }