Skip to content

Commit 48930a5

Browse files
committed
Added demo showcasing a basic CheckBoxList.
1 parent 8c9f8a2 commit 48930a5

File tree

5 files changed

+235
-0
lines changed

5 files changed

+235
-0
lines changed

IAS_CheckBoxList.xml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<DMSScript options="272" xmlns="http://www.skyline.be/automation">
3+
<Name>IAS_CheckBoxList</Name>
4+
<Description></Description>
5+
<Type>Automation</Type>
6+
<Author>SKYLINE2\ThomasRE</Author>
7+
<CheckSets>FALSE</CheckSets>
8+
<Folder></Folder>
9+
10+
<Protocols>
11+
</Protocols>
12+
13+
<Memory>
14+
</Memory>
15+
16+
<Parameters>
17+
</Parameters>
18+
19+
<Script>
20+
<Exe id="1" type="csharp">
21+
<Value><![CDATA[[Project:IAS_CheckBoxList_1]]]></Value>
22+
<!--<Param type="debug">true</Param>-->
23+
<Message></Message>
24+
</Exe>
25+
</Script>
26+
</DMSScript>
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
namespace IAS_CheckBoxList_1
2+
{
3+
using Skyline.DataMiner.Automation;
4+
using Skyline.DataMiner.Utils.InteractiveAutomationScript;
5+
using System;
6+
using System.Collections.Generic;
7+
8+
public class CheckBoxListDialog : Dialog
9+
{
10+
private readonly CheckBoxList checkBoxList;
11+
private readonly TextBox checkedOptionsTextBox;
12+
private readonly Button exitButton;
13+
14+
private readonly IEnumerable<string> options = new string[]
15+
{
16+
"Yes",
17+
"An Option",
18+
"Another One",
19+
"Option X",
20+
"Something something Dark Side"
21+
};
22+
23+
public CheckBoxListDialog(IEngine engine) : base(engine)
24+
{
25+
Title = "Select Option(s)";
26+
27+
// Set up checkboxlist
28+
checkBoxList = new CheckBoxList(options) { IsSorted = true };
29+
checkBoxList.Changed += (s, e) => checkedOptionsTextBox.Text = String.Join(Environment.NewLine, checkBoxList.Checked);
30+
31+
// Set up textbox
32+
checkedOptionsTextBox = new TextBox { IsMultiline = true, Height = 150 };
33+
34+
// Set up exit button
35+
exitButton = new Button("Exit");
36+
exitButton.Pressed += (s, e) => OnExitButtonPressed?.Invoke(this, EventArgs.Empty);
37+
38+
// Generate Ui
39+
AddWidget(new Label("Select Option(s)"), 0, 0, verticalAlignment: VerticalAlignment.Top);
40+
AddWidget(checkBoxList, 0, 1);
41+
AddWidget(checkedOptionsTextBox, 1, 0, 1, 2);
42+
AddWidget(exitButton, 2, 0, 1, 2);
43+
}
44+
45+
public event EventHandler OnExitButtonPressed;
46+
}
47+
}
Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
/*
2+
****************************************************************************
3+
* Copyright (c) 2024, Skyline Communications NV All Rights Reserved. *
4+
****************************************************************************
5+
6+
By using this script, you expressly agree with the usage terms and
7+
conditions set out below.
8+
This script and all related materials are protected by copyrights and
9+
other intellectual property rights that exclusively belong
10+
to Skyline Communications.
11+
12+
A user license granted for this script is strictly for personal use only.
13+
This script may not be used in any way by anyone without the prior
14+
written consent of Skyline Communications. Any sublicensing of this
15+
script is forbidden.
16+
17+
Any modifications to this script by the user are only allowed for
18+
personal use and within the intended purpose of the script,
19+
and will remain the sole responsibility of the user.
20+
Skyline Communications will not be responsible for any damages or
21+
malfunctions whatsoever of the script resulting from a modification
22+
or adaptation by the user.
23+
24+
The content of this script is confidential information.
25+
The user hereby agrees to keep this confidential information strictly
26+
secret and confidential and not to disclose or reveal it, in whole
27+
or in part, directly or indirectly to any person, entity, organization
28+
or administration without the prior written consent of
29+
Skyline Communications.
30+
31+
Any inquiries can be addressed to:
32+
33+
Skyline Communications NV
34+
Ambachtenstraat 33
35+
B-8870 Izegem
36+
Belgium
37+
Tel. : +32 51 31 35 69
38+
Fax. : +32 51 31 01 29
39+
40+
Web : www.skyline.be
41+
Contact : Ben Vandenberghe
42+
43+
****************************************************************************
44+
Revision History:
45+
46+
DATE VERSION AUTHOR COMMENTS
47+
48+
dd/mm/2024 1.0.0.1 XXX, Skyline Initial version
49+
****************************************************************************
50+
*/
51+
52+
namespace IAS_CheckBoxList_1
53+
{
54+
using System;
55+
using Skyline.DataMiner.Automation;
56+
using Skyline.DataMiner.Utils.InteractiveAutomationScript;
57+
58+
/// <summary>
59+
/// Represents a DataMiner Automation script.
60+
/// </summary>
61+
public class Script
62+
{
63+
private InteractiveController app;
64+
65+
/// <summary>
66+
/// The Script entry point.
67+
/// IEngine.ShowUI();.
68+
/// </summary>
69+
/// <param name="engine">Link with SLAutomation process.</param>
70+
public void Run(IEngine engine)
71+
{
72+
try
73+
{
74+
app = new InteractiveController(engine);
75+
76+
engine.SetFlag(RunTimeFlags.NoKeyCaching);
77+
engine.Timeout = TimeSpan.FromHours(10);
78+
79+
RunSafe(engine);
80+
}
81+
catch (ScriptAbortException)
82+
{
83+
throw;
84+
}
85+
catch (ScriptForceAbortException)
86+
{
87+
throw;
88+
}
89+
catch (ScriptTimeoutException)
90+
{
91+
throw;
92+
}
93+
catch (InteractiveUserDetachedException)
94+
{
95+
throw;
96+
}
97+
catch (Exception e)
98+
{
99+
engine.Log("Run|Something went wrong: " + e);
100+
ShowExceptionDialog(engine, e);
101+
}
102+
}
103+
104+
private void RunSafe(IEngine engine)
105+
{
106+
CheckBoxListDialog dialog = new CheckBoxListDialog(engine);
107+
dialog.OnExitButtonPressed += (s, e) => engine.ExitSuccess("Exit button pressed");
108+
app.Run(dialog);
109+
}
110+
111+
private void ShowExceptionDialog(IEngine engine, Exception exception)
112+
{
113+
ExceptionDialog exceptionDialog = new ExceptionDialog(engine, exception);
114+
exceptionDialog.OkButton.Pressed += (sender, args) => engine.ExitFail("Something went wrong.");
115+
if (app.IsRunning) app.ShowDialog(exceptionDialog); else app.Run(exceptionDialog);
116+
}
117+
}
118+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
<PropertyGroup>
3+
<TargetFramework>net48</TargetFramework>
4+
<Company>Skyline Communications</Company>
5+
<Copyright>© Skyline Communications</Copyright>
6+
<GenerateDocumentationFile>True</GenerateDocumentationFile>
7+
</PropertyGroup>
8+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
9+
<DebugType>full</DebugType>
10+
<CodeAnalysisRuleSet>..\Internal\Code Analysis\qaction-debug.ruleset</CodeAnalysisRuleSet>
11+
</PropertyGroup>
12+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
13+
<DebugType>pdbonly</DebugType>
14+
<CodeAnalysisRuleSet>..\Internal\Code Analysis\qaction-release.ruleset</CodeAnalysisRuleSet>
15+
</PropertyGroup>
16+
<PropertyGroup>
17+
<DefineConstants>$(DefineConstants);DCFv1;DBInfo;ALARM_SQUASHING</DefineConstants>
18+
</PropertyGroup>
19+
<ItemGroup>
20+
<PackageReference Include="Skyline.DataMiner.Dev.Automation" Version="10.3.7" />
21+
<PackageReference Include="Skyline.DataMiner.Utils.InteractiveAutomationScriptToolkit" Version="7.0.5" />
22+
</ItemGroup>
23+
<ProjectExtensions>
24+
<VisualStudio>
25+
<UserProperties DisLinkedXmlFile="..\IAS_CheckBoxList.xml" DisProjectType="automationScriptProject" DisLinkId="1" />
26+
</VisualStudio>
27+
</ProjectExtensions>
28+
</Project>

SLC-AS-Example_InteractiveAutomationScriptToolkit.sln

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,15 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Actions", "Actions", "{DC19
5555
EndProject
5656
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IAS_DynamicButtonList_1", "IAS_DynamicButtonList_1\IAS_DynamicButtonList_1.csproj", "{FC5B19B5-BCB9-4512-963B-E0572EFEC0AA}"
5757
EndProject
58+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "IAS_CheckBoxList", "IAS_CheckBoxList", "{E1317C39-C65D-4D89-BB72-F5F284341A94}"
59+
ProjectSection(SolutionItems) = preProject
60+
IAS_CheckBoxList.xml = IAS_CheckBoxList.xml
61+
EndProjectSection
62+
EndProject
63+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Actions", "Actions", "{7F10AEC8-9A16-46AB-A6D6-3CF01E2F2AA3}"
64+
EndProject
65+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IAS_CheckBoxList_1", "IAS_CheckBoxList_1\IAS_CheckBoxList_1.csproj", "{3B0B0E09-A26C-4F9A-AFDA-A7D7FC4F50EF}"
66+
EndProject
5867
Global
5968
GlobalSection(SolutionConfigurationPlatforms) = preSolution
6069
Debug|Any CPU = Debug|Any CPU
@@ -69,6 +78,10 @@ Global
6978
{FC5B19B5-BCB9-4512-963B-E0572EFEC0AA}.Debug|Any CPU.Build.0 = Debug|Any CPU
7079
{FC5B19B5-BCB9-4512-963B-E0572EFEC0AA}.Release|Any CPU.ActiveCfg = Release|Any CPU
7180
{FC5B19B5-BCB9-4512-963B-E0572EFEC0AA}.Release|Any CPU.Build.0 = Release|Any CPU
81+
{3B0B0E09-A26C-4F9A-AFDA-A7D7FC4F50EF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
82+
{3B0B0E09-A26C-4F9A-AFDA-A7D7FC4F50EF}.Debug|Any CPU.Build.0 = Debug|Any CPU
83+
{3B0B0E09-A26C-4F9A-AFDA-A7D7FC4F50EF}.Release|Any CPU.ActiveCfg = Release|Any CPU
84+
{3B0B0E09-A26C-4F9A-AFDA-A7D7FC4F50EF}.Release|Any CPU.Build.0 = Release|Any CPU
7285
EndGlobalSection
7386
GlobalSection(SolutionProperties) = preSolution
7487
HideSolutionNode = FALSE
@@ -82,6 +95,9 @@ Global
8295
{D681C23E-FB47-47E8-8A3A-8B08312DCB4A} = {A81CCA8A-5280-4798-9442-62C6C68CAD61}
8396
{DC19D4E2-B1E5-41E4-BAD4-BCA2924D3D6D} = {D681C23E-FB47-47E8-8A3A-8B08312DCB4A}
8497
{FC5B19B5-BCB9-4512-963B-E0572EFEC0AA} = {DC19D4E2-B1E5-41E4-BAD4-BCA2924D3D6D}
98+
{E1317C39-C65D-4D89-BB72-F5F284341A94} = {A81CCA8A-5280-4798-9442-62C6C68CAD61}
99+
{7F10AEC8-9A16-46AB-A6D6-3CF01E2F2AA3} = {E1317C39-C65D-4D89-BB72-F5F284341A94}
100+
{3B0B0E09-A26C-4F9A-AFDA-A7D7FC4F50EF} = {7F10AEC8-9A16-46AB-A6D6-3CF01E2F2AA3}
85101
EndGlobalSection
86102
GlobalSection(ExtensibilityGlobals) = postSolution
87103
SolutionGuid = {D10F5189-03D7-4B39-86D5-220E1112B68C}

0 commit comments

Comments
 (0)