Skip to content

Commit d2c9f7b

Browse files
committed
Created solution with two examples.
1 parent af55664 commit d2c9f7b

25 files changed

+1699
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
This folder can contain any file you would like to add under the Skyline DataMiner folder while installing the Automation scripts.

Directory.Build.props

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<Project>
2+
<PropertyGroup>
3+
<PlatformTarget>x86</PlatformTarget>
4+
<DisableImplicitFrameworkReferences>true</DisableImplicitFrameworkReferences>
5+
</PropertyGroup>
6+
<ItemGroup>
7+
<AdditionalFiles Include="..\Internal\Code Analysis\stylecop.json">
8+
<Link>Properties\stylecop.json</Link>
9+
</AdditionalFiles>
10+
<Content Include="..\Internal\.editorconfig">
11+
<Link>Properties\.editorconfig</Link>
12+
</Content>
13+
</ItemGroup>
14+
<ItemGroup>
15+
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118">
16+
<PrivateAssets>all</PrivateAssets>
17+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
18+
</PackageReference>
19+
</ItemGroup>
20+
</Project>

Dlls/ABOUT.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
This folder contains DLL files that should be placed under the ProtocolScripts folder of DataMiner for this solution to work correctly.

Documentation/ABOUT.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Looking for README.md? Check your Solution Root folder. This folder can be used to add documentation related to this solution.

IAS_DropDownFilter.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_DropDownFilter</Name>
4+
<Description></Description>
5+
<Type>Automation</Type>
6+
<Author>SKYLINE2\TRE</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_DropDownFilter_1]]]></Value>
22+
<!--<Param type="debug">true</Param>-->
23+
<Message></Message>
24+
</Exe>
25+
</Script>
26+
</DMSScript>
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
namespace IAS_DropDownFilter_1
2+
{
3+
using System;
4+
using System.Linq;
5+
using Skyline.DataMiner.Automation;
6+
using Skyline.DataMiner.Core.DataMinerSystem.Automation;
7+
using Skyline.DataMiner.Utils.InteractiveAutomationScript;
8+
9+
public class DropDownFilterDialog : Dialog
10+
{
11+
private readonly DropDown elementDropDown;
12+
private readonly Button exitButton;
13+
14+
public DropDownFilterDialog(IEngine engine) : base(engine)
15+
{
16+
Title = "Select an Element";
17+
18+
// Set up dropdown
19+
var dms = engine.GetDms();
20+
elementDropDown = new DropDown(dms.GetElements().Select(x => x.Name))
21+
{
22+
IsDisplayFilterShown = true, // Allows user to filter in dropdown options
23+
IsSorted = true, // Sorts the options alphabetically
24+
};
25+
26+
elementDropDown.Changed += (s, e) => OnElementSelected?.Invoke(this, new ElementSelectedEventArgs(e.Selected));
27+
28+
// Set up exit button
29+
exitButton = new Button("Exit");
30+
exitButton.Pressed += (s, e) => OnExitButtonPressed?.Invoke(this, EventArgs.Empty);
31+
32+
// Generate Ui
33+
AddWidget(new Label("Hint: you can type in the dropdown to filter options"), 0, 0);
34+
AddWidget(elementDropDown, 1, 0);
35+
AddWidget(exitButton, 2, 0);
36+
}
37+
38+
public event EventHandler<ElementSelectedEventArgs> OnElementSelected;
39+
40+
public event EventHandler OnExitButtonPressed;
41+
}
42+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
namespace IAS_DropDownFilter_1
2+
{
3+
using System;
4+
5+
public class ElementSelectedEventArgs : EventArgs
6+
{
7+
public ElementSelectedEventArgs(string elementName)
8+
{
9+
ElementName = elementName;
10+
}
11+
12+
public string ElementName { get; private set; }
13+
}
14+
}
Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
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+
27/02/2024 1.0.0.1 TRE, Skyline Initial version
49+
****************************************************************************
50+
*/
51+
52+
namespace IAS_DropDownFilter_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+
private IEngine engine;
65+
private DropDownFilterDialog dialog;
66+
67+
/// <summary>
68+
/// The Script entry point.
69+
/// IEngine.ShowUI();.
70+
/// </summary>
71+
/// <param name="engine">Link with SLAutomation process.</param>
72+
public void Run(IEngine engine)
73+
{
74+
try
75+
{
76+
app = new InteractiveController(engine);
77+
78+
this.engine = engine;
79+
engine.SetFlag(RunTimeFlags.NoKeyCaching);
80+
engine.Timeout = TimeSpan.FromHours(10);
81+
82+
RunSafe(engine);
83+
}
84+
catch (ScriptAbortException)
85+
{
86+
throw;
87+
}
88+
catch (ScriptForceAbortException)
89+
{
90+
throw;
91+
}
92+
catch (ScriptTimeoutException)
93+
{
94+
throw;
95+
}
96+
catch (InteractiveUserDetachedException)
97+
{
98+
throw;
99+
}
100+
catch (Exception e)
101+
{
102+
engine.Log("Run|Something went wrong: " + e);
103+
ShowExceptionDialog(engine, e);
104+
}
105+
}
106+
107+
private void RunSafe(IEngine engine)
108+
{
109+
dialog = new DropDownFilterDialog(engine);
110+
dialog.OnElementSelected += Dialog_OnElementSelected;
111+
dialog.OnExitButtonPressed += Dialog_OnExitButtonPressed;
112+
app.Run(dialog);
113+
}
114+
115+
private void Dialog_OnElementSelected(object sender, ElementSelectedEventArgs e)
116+
{
117+
var messageDialog = new MessageDialog(engine, $"You selected element {e.ElementName}.") { Title = "Selected Element" };
118+
messageDialog.OkButton.Pressed += MessageDialog_OkButton_Pressed;
119+
app.ShowDialog(messageDialog);
120+
}
121+
122+
private void MessageDialog_OkButton_Pressed(object sender, EventArgs e)
123+
{
124+
app.ShowDialog(dialog);
125+
}
126+
127+
private void Dialog_OnExitButtonPressed(object sender, EventArgs e)
128+
{
129+
engine.ExitSuccess("Exit");
130+
}
131+
132+
private void ShowExceptionDialog(IEngine engine, Exception exception)
133+
{
134+
ExceptionDialog exceptionDialog = new ExceptionDialog(engine, exception);
135+
exceptionDialog.OkButton.Pressed += (sender, args) => engine.ExitFail("Something went wrong.");
136+
if (app.IsRunning) app.ShowDialog(exceptionDialog); else app.Run(exceptionDialog);
137+
}
138+
}
139+
}
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>net462</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+
<ProjectExtensions>
20+
<VisualStudio>
21+
<UserProperties DisLinkedXmlFile="..\IAS_DropDownFilter.xml" DisProjectType="automationScriptProject" DisLinkId="1" />
22+
</VisualStudio>
23+
</ProjectExtensions>
24+
<ItemGroup>
25+
<PackageReference Include="Skyline.DataMiner.Core.DataMinerSystem.Automation" Version="1.1.1.5" />
26+
<PackageReference Include="Skyline.DataMiner.Utils.InteractiveAutomationScriptToolkit" Version="7.0.4" />
27+
</ItemGroup>
28+
</Project>

IAS_DropDownFilter_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+

0 commit comments

Comments
 (0)