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+ }
0 commit comments