Skip to content

Commit 186edb7

Browse files
Merge pull request #9 from RijadComor/main
new example script for HideUI method
2 parents 452d83a + 672961a commit 186edb7

File tree

7 files changed

+289
-0
lines changed

7 files changed

+289
-0
lines changed

IAS_HideUI.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_HideUI</Name>
4+
<Description></Description>
5+
<Type>Automation</Type>
6+
<Author>SKYLINE2\RijadCO</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_HideUI_1]]]></Value>
22+
<!--<Param type="debug">true</Param>-->
23+
<Message></Message>
24+
</Exe>
25+
</Script>
26+
</DMSScript>

IAS_HideUI_1/HideUIPanel.cs

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
namespace IAS_HideUI_1
2+
{
3+
using Skyline.DataMiner.Automation;
4+
using Skyline.DataMiner.Utils.InteractiveAutomationScript;
5+
using System;
6+
using System.Collections.Generic;
7+
using System.Linq;
8+
9+
public class HideUIPanel : Dialog
10+
{
11+
private readonly Label hideUiLabel = new Label("Hide UI:");
12+
13+
private readonly Label showUiAgainLabel = new Label("Show UI again after background action?");
14+
15+
public HideUIPanel(IEngine engine) : base(engine)
16+
{
17+
Title = "Hide UI";
18+
19+
Initialize();
20+
GenerateUi();
21+
}
22+
23+
public Button HideUiButton { get; set; }
24+
25+
public CheckBox HideUiCheckBox { get; set; }
26+
27+
private void Initialize()
28+
{
29+
HideUiButton = new Button("Hide");
30+
HideUiCheckBox = new CheckBox { IsChecked = false };
31+
}
32+
33+
private void GenerateUi()
34+
{
35+
Clear();
36+
37+
int row = -1;
38+
AddWidget(hideUiLabel, ++row, 0);
39+
AddWidget(HideUiButton, row, 1);
40+
AddWidget(showUiAgainLabel, ++row, 0);
41+
AddWidget(HideUiCheckBox, row, 1);
42+
}
43+
}
44+
}

IAS_HideUI_1/IAS_HideUI_1.cs

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
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+
E-mail : info@skyline.be
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_HideUI_1
53+
{
54+
using System;
55+
using System.Collections.Generic;
56+
using System.Globalization;
57+
using System.Text;
58+
using System.Threading;
59+
using Skyline.DataMiner.Automation;
60+
using Skyline.DataMiner.Utils.InteractiveAutomationScript;
61+
62+
/// <summary>
63+
/// Represents a DataMiner Automation script.
64+
/// </summary>
65+
public class Script
66+
{
67+
private InteractiveController app;
68+
private IEngine engine;
69+
private HideUIPanel hideUiPanel;
70+
71+
/// <summary>
72+
/// The script entry point.
73+
/// </summary>
74+
/// <param name="engine">Link with SLAutomation process.</param>
75+
public void Run(IEngine engine)
76+
{
77+
try
78+
{
79+
app = new InteractiveController(engine);
80+
this.engine = engine;
81+
82+
engine.SetFlag(RunTimeFlags.NoKeyCaching);
83+
engine.Timeout = TimeSpan.FromHours(10);
84+
85+
RunSafe(engine);
86+
}
87+
catch (ScriptAbortException)
88+
{
89+
// Catch normal abort exceptions (engine.ExitFail or engine.ExitSuccess)
90+
throw; // Comment if it should be treated as a normal exit of the script.
91+
}
92+
catch (ScriptForceAbortException)
93+
{
94+
// Catch forced abort exceptions, caused via external maintenance messages.
95+
throw;
96+
}
97+
catch (ScriptTimeoutException)
98+
{
99+
// Catch timeout exceptions for when a script has been running for too long.
100+
throw;
101+
}
102+
catch (InteractiveUserDetachedException)
103+
{
104+
// Catch a user detaching from the interactive script by closing the window.
105+
// Only applicable for interactive scripts, can be removed for non-interactive scripts.
106+
throw;
107+
}
108+
catch (Exception e)
109+
{
110+
engine.ExitFail("Run|Something went wrong: " + e);
111+
}
112+
}
113+
114+
private void RunSafe(IEngine engine)
115+
{
116+
// engine.ShowUI()
117+
hideUiPanel = new HideUIPanel(engine);
118+
hideUiPanel.HideUiButton.Pressed += HideUiButton_Pressed;
119+
app.ShowDialog(hideUiPanel);
120+
}
121+
122+
private void HideUiButton_Pressed(object sender, EventArgs e)
123+
{
124+
app.Hide();
125+
126+
// Imagine this is our background action behind button
127+
Thread.Sleep(5000);
128+
129+
if (hideUiPanel.HideUiCheckBox.IsChecked)
130+
app.ShowDialog(hideUiPanel);
131+
}
132+
}
133+
}

IAS_HideUI_1/IAS_HideUI_1.csproj

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.4.7" />
21+
<PackageReference Include="Skyline.DataMiner.Utils.InteractiveAutomationScriptToolkit" Version="9.0.2" />
22+
</ItemGroup>
23+
<ProjectExtensions>
24+
<VisualStudio>
25+
<UserProperties DisLinkedXmlFile="..\IAS_HideUI.xml" DisProjectType="automationScriptProject" DisLinkId="1" />
26+
</VisualStudio>
27+
</ProjectExtensions>
28+
</Project>

IAS_HideUI_1/LICENSE.txt

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
SKYLINE LIBRARY LICENSE
2+
3+
1. Applicability
4+
The software in this repository (hereafter the “Software”) is owned by Skyline Communications (hereafter “Skyline”). The terms of this license govern your use of the Software. If you do not agree with the terms of this license, you may not use or exploit the Software in any other manner.
5+
2. Grant of rights
6+
You may use the Software for the development, testing and validation of DataMiner packages and components only.
7+
You may not use this Software in any other manner unless you have obtained Skyline’s prior written authorization to do so.
8+
It is forbidden to create derivative works of the Software.
9+
3. Intellectual property
10+
Skyline owns the intellectual property rights vested in the Software. Skyline granting you access to the Software does not entail permission to utilize or otherwise manipulate the Software in contravention to this Library License. Skyline reserves the right to pursue legal action against you in case of breach of its intellectual property rights.
11+
4. No warranty
12+
Skyline provides the Software ‘as is’, without any warranty of any kind.
13+
5. Limitation of liability
14+
Within the maximum possible extent under the applicable laws, Skyline disclaims all liability for the Software.
15+
6. Applicable laws and jurisdiction
16+
This license shall be governed by the laws of Belgium. Any dispute shall be submitted to the exclusive jurisdiction of the competent courts of Gent, division Kortrijk, Belgium
17+

IAS_HideUI_1/README.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# IAS_CheckBoxList
2+
3+
## About
4+
5+
This automation script is a basic demo of how to use InteractiveController.Hide() method. This method will hide interactive script and eventually close it if we don't show any dialog after all actions are done.
6+
7+
![hideUi](https://github.com/user-attachments/assets/13473ec5-deff-4e2e-933f-b3255651e010)
8+
9+
### About DataMiner
10+
11+
DataMiner is a transformational platform that provides vendor-independent control and monitoring of devices and services. Out of the box and by design, it addresses key challenges such as security, complexity, multi-cloud, and much more. It has a pronounced open architecture and powerful capabilities enabling users to evolve easily and continuously.
12+
13+
The foundation of DataMiner is its powerful and versatile data acquisition and control layer. With DataMiner, there are no restrictions to what data users can access. Data sources may reside on premises, in the cloud, or in a hybrid setup.
14+
15+
A unique catalog of 7000+ connectors already exists. In addition, you can leverage DataMiner Development Packages to build your own connectors (also known as "protocols" or "drivers").
16+
17+
> **Note**
18+
> See also: [About DataMiner](https://aka.dataminer.services/about-dataminer).
19+
20+
### About Skyline Communications
21+
22+
At Skyline Communications, we deal with world-class solutions that are deployed by leading companies around the globe. Check out [our proven track record](https://aka.dataminer.services/about-skyline) and see how we make our customers' lives easier by empowering them to take their operations to the next level.
23+
24+
<!-- Uncomment below and add more info to provide more information about how to use this package. -->
25+
<!-- ## Getting Started -->

SLC-AS-Example_InteractiveAutomationScriptToolkit.sln

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,15 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Actions", "Actions", "{7F10
6464
EndProject
6565
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IAS_CheckBoxList_1", "IAS_CheckBoxList_1\IAS_CheckBoxList_1.csproj", "{3B0B0E09-A26C-4F9A-AFDA-A7D7FC4F50EF}"
6666
EndProject
67+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "IAS_HideUI", "IAS_HideUI", "{A83E1336-D502-496D-9048-EE6A95231572}"
68+
ProjectSection(SolutionItems) = preProject
69+
IAS_HideUI.xml = IAS_HideUI.xml
70+
EndProjectSection
71+
EndProject
72+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Actions", "Actions", "{13E1A298-3A8E-4140-B2DA-484E4CC0CC6B}"
73+
EndProject
74+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IAS_HideUI_1", "IAS_HideUI_1\IAS_HideUI_1.csproj", "{CE7701AB-8412-489A-96B2-0FCB758E7E93}"
75+
EndProject
6776
Global
6877
GlobalSection(SolutionConfigurationPlatforms) = preSolution
6978
Debug|Any CPU = Debug|Any CPU
@@ -82,6 +91,10 @@ Global
8291
{3B0B0E09-A26C-4F9A-AFDA-A7D7FC4F50EF}.Debug|Any CPU.Build.0 = Debug|Any CPU
8392
{3B0B0E09-A26C-4F9A-AFDA-A7D7FC4F50EF}.Release|Any CPU.ActiveCfg = Release|Any CPU
8493
{3B0B0E09-A26C-4F9A-AFDA-A7D7FC4F50EF}.Release|Any CPU.Build.0 = Release|Any CPU
94+
{CE7701AB-8412-489A-96B2-0FCB758E7E93}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
95+
{CE7701AB-8412-489A-96B2-0FCB758E7E93}.Debug|Any CPU.Build.0 = Debug|Any CPU
96+
{CE7701AB-8412-489A-96B2-0FCB758E7E93}.Release|Any CPU.ActiveCfg = Release|Any CPU
97+
{CE7701AB-8412-489A-96B2-0FCB758E7E93}.Release|Any CPU.Build.0 = Release|Any CPU
8598
EndGlobalSection
8699
GlobalSection(SolutionProperties) = preSolution
87100
HideSolutionNode = FALSE
@@ -98,6 +111,9 @@ Global
98111
{E1317C39-C65D-4D89-BB72-F5F284341A94} = {A81CCA8A-5280-4798-9442-62C6C68CAD61}
99112
{7F10AEC8-9A16-46AB-A6D6-3CF01E2F2AA3} = {E1317C39-C65D-4D89-BB72-F5F284341A94}
100113
{3B0B0E09-A26C-4F9A-AFDA-A7D7FC4F50EF} = {7F10AEC8-9A16-46AB-A6D6-3CF01E2F2AA3}
114+
{A83E1336-D502-496D-9048-EE6A95231572} = {A81CCA8A-5280-4798-9442-62C6C68CAD61}
115+
{13E1A298-3A8E-4140-B2DA-484E4CC0CC6B} = {A83E1336-D502-496D-9048-EE6A95231572}
116+
{CE7701AB-8412-489A-96B2-0FCB758E7E93} = {13E1A298-3A8E-4140-B2DA-484E4CC0CC6B}
101117
EndGlobalSection
102118
GlobalSection(ExtensibilityGlobals) = postSolution
103119
SolutionGuid = {D10F5189-03D7-4B39-86D5-220E1112B68C}

0 commit comments

Comments
 (0)