aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/FSE/Modules/Tango.FSE.Procedures/IProcedureContext.cs
blob: f421a88f53733557514107f34dc9be729efebcd0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
using Google.Protobuf;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Drawing;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Tango.BL.Entities;
using Tango.Core;
using Tango.FSE.Common.Connection;
using Tango.FSE.Common.DataStore;
using Tango.FSE.Common.Diagnostics;
using Tango.Integration.Operation;
using Tango.Scripting.Basic;
using Tango.Scripting.Editors.Intellisense;

namespace Tango.FSE.Procedures
{
    /// <summary>
    /// Represents the main procedures API.
    /// </summary>
    /// <seealso cref="Tango.Scripting.Basic.IContext" />
    public interface IProcedureContext : IContext
    {
        /// <summary>
        /// Occurs when the procedure is reporting about some progress.
        /// </summary>
        [HideIntellisense]
        event EventHandler<TangoProgressChangedEventArgs<double>> Progress;

        /// <summary>
        /// Occurs when a procedure object break point request occurs through the IDE break points.
        /// </summary>
        [HideIntellisense]
        event EventHandler<BreakPointRequestEventArgs> BreakPointRequest;

        /// <summary>
        /// Gets the list of current results.
        /// </summary>
        [HideIntellisense]
        ReadOnlyCollection<Result> Results { get; }

        /// <summary>
        /// Adds a new procedure result.
        /// The value object can be a primitive, a collection of primitives or a collection of complex types.
        /// </summary>
        /// <param name="type">Result type.</param>
        /// <param name="name">Result title.</param>
        /// <param name="value">Result value.</param>
        /// <returns>The result instance.</returns>
        /// <example>
        /// <para>
        /// <i>
        /// The following example demonstrates how to add various procedure results.
        /// </i>
        /// </para>
        /// <code lang="C#" source="../Tango.FSE.Procedures/Examples/AddResult/Program.cs" title="Add results" region="Example" />
        /// </example>
        Result AddResult(ResultType type, String name, object value);

        /// <summary>
        /// Adds a new procedure result that will be displayed as a graph with X/Y axis.
        /// The specified values will be plotted as Y axis values while the X axis will be auto generated by each value index.
        /// </summary>
        /// <param name="type">Result type.</param>
        /// <param name="name">Result title.</param>
        /// <param name="values">Graph Y axis values.</param>
        /// <returns>The result instance.</returns>
        /// <example>
        /// <para>
        /// <i>
        /// The following example demonstrates how to add various procedure results.
        /// </i>
        /// </para>
        /// <code lang="C#" source="../Tango.FSE.Procedures/Examples/AddResult/Program.cs" title="Add results" region="Example" />
        /// </example>
        Result AddGraphResult(ResultType type, String name, IEnumerable<double> values);

        /// <summary>
        /// Adds a new procedure result with custom appearance by providing a bitmap to draw as the result.
        /// Use the <see cref="CreateBitmap(int, int)"/> to create a new bitmap.
        /// Then, <see cref="GetDrawingContext(Bitmap)"/> to get the bitmap drawing context in order to start drawing.
        /// </summary>
        /// <param name="type">Result type.</param>
        /// <param name="name">Result title.</param>
        /// <param name="bitmap">Result bitmap.</param>
        /// <returns>The result instance.</returns>
        /// <example>
        /// <para>
        /// <i>
        /// The following example demonstrates how to add various procedure results.
        /// </i>
        /// </para>
        /// <code lang="C#" source="../Tango.FSE.Procedures/Examples/AddResult/Program.cs" title="Add results" region="Example" />
        /// </example>
        Result AddBitmapResult(ResultType type, String name, Bitmap bitmap);

        /// <summary>
        /// Creates a new bitmap to be provided as a bitmap result via <see cref="AddBitmapResult(ResultType, string, Bitmap)"/>.
        /// </summary>
        /// <param name="width">The bitmap width.</param>
        /// <param name="height">The bitmap height.</param>
        /// <returns>The bitmap instance.</returns>
        Bitmap CreateBitmap(int width, int height);

        /// <summary>
        /// Creates a new drawing context for the specified bitmap.
        /// </summary>
        /// <remarks>
        /// Please use <see cref="Graphics.Dispose"/> when finish drawing.
        /// </remarks>
        /// <param name="bitmap">The bitmap.</param>
        /// <returns>The drawing context.</returns>
        Graphics GetDrawingContext(Bitmap bitmap);

        /// <summary>
        /// Adds a new procedure result.
        /// </summary>
        /// <param name="result">The result.</param>
        /// <returns></returns>
        [HideIntellisense]
        Result AddResult(Result result);

        /// <summary>
        /// Removes the specified procedure result.
        /// </summary>
        /// <param name="result">The result.</param>
        void RemoveResult(Result result);

        /// <summary>
        /// Clears all current procedure results.
        /// </summary>
        void ClearResults();

        /// <summary>
        /// Sends a stub request by name, with optional timeout and comma separated arguments.
        /// </summary>
        /// <remarks>
        /// This method accepts only stub messages.
        /// </remarks>
        /// <param name="messageName">Full or shortened name of the message (e.g "CalculateRequest" or "calculate").</param>
        /// <param name="timeout">Request timeout.</param>
        /// <param name="args">Request arguments separated by commas.</param>
        /// <returns>The corresponding response message.</returns>
        /// <example>
        /// <para>
        /// <i>
        /// The following example demonstrates how to send a request to the machine and get a response using the various different Send method overrides.
        /// </i>
        /// </para>
        /// <code lang="C#" source="../Tango.FSE.Procedures/Examples/Send/Program.cs" title="Send a request" region="Example" />
        /// </example>
        IMessage Send(String messageName, TimeSpan? timeout = null, params Object[] args);

        /// <summary>
        /// Sends a request by name with optional comma separated arguments.
        /// </summary>
        /// <remarks>
        /// This method accepts only stub messages.
        /// </remarks>
        /// <param name="messageName">Full or shortened name of the message (e.g "CalculateRequest" or "calculate").</param>
        /// <param name="args">Request arguments separated by commas.</param>
        /// <returns>The corresponding response message.</returns>
        /// <example>
        /// <para>
        /// <i>
        /// The following example demonstrates how to send a request to the machine and get a response using the various different Send method overrides.
        /// </i>
        /// </para>
        /// <code lang="C#" source="../Tango.FSE.Procedures/Examples/Send/Program.cs" title="Send a request" region="Example" />
        /// </example>
        IMessage Send(String messageName, params Object[] args);

        /// <summary>
        /// Sends a request by name with optional timeout and comma separated arguments.
        /// </summary>
        /// <remarks>
        /// This method accepts only stub messages.
        /// </remarks>
        /// <typeparam name="T">Type of expected response message.</typeparam>
        /// <param name="messageName">Full or shortened name of the message (e.g "CalculateRequest" or "calculate").</param>
        /// <param name="timeout">The request timeout.</param>
        /// <param name="args">Request arguments separated by commas.</param>
        /// <returns>The corresponding response message of type T.</returns>
        /// <example>
        /// <para>
        /// <i>
        /// The following example demonstrates how to send a request to the machine and get a response using the various different Send method overrides.
        /// </i>
        /// </para>
        /// <code lang="C#" source="../Tango.FSE.Procedures/Examples/Send/Program.cs" title="Send a request" region="Example" />
        /// </example>
        T Send<T>(String messageName, TimeSpan? timeout = null, params Object[] args) where T : class, IMessage;

        /// <summary>
        /// Sends a request by name with optional comma separated arguments.
        /// </summary>
        /// <remarks>
        /// This method accepts only stub messages.
        /// </remarks>
        /// <typeparam name="T">Type of expected response message.</typeparam>
        /// <param name="messageName">Full or shortened name of the message (e.g "CalculateRequest" or "calculate").</param>
        /// <param name="args">Request arguments separated by commas.</param>
        /// <returns>The corresponding response message of type T.</returns>
        /// <example>
        /// <para>
        /// <i>
        /// The following example demonstrates how to send a request to the machine and get a response using the various different Send method overrides.
        /// </i>
        /// </para>
        /// <code lang="C#" source="../Tango.FSE.Procedures/Examples/Send/Program.cs" title="Send a request" region="Example" />
        /// </example>
        T Send<T>(String messageName, params Object[] args) where T : class, IMessage;

        /// <summary>
        /// Sends the specified request message.
        /// </summary>
        /// <param name="message">Request message instance.</param>
        /// <param name="timeout">Request timeout in seconds. (leave empty to get the default timeout)</param>
        /// <returns>The corresponding response message.</returns>
        /// <example>
        /// <para>
        /// <i>
        /// The following example demonstrates how to send a request to the machine and get a response using the various different Send method overrides.
        /// </i>
        /// </para>
        /// <code lang="C#" source="../Tango.FSE.Procedures/Examples/Send/Program.cs" title="Send a request" region="Example" />
        /// </example>
        IMessage Send(IMessage message, int? timeout = null);

        /// <summary>
        /// Sends the specified request message.
        /// </summary>
        /// <typeparam name="T">Type of expected response message.</typeparam>
        /// <param name="message">Request message instance.</param>
        /// <param name="timeout">Request timeout in seconds. (leave empty to get the default timeout)</param>
        /// <returns>The corresponding response message of type T.</returns>
        /// <example>
        /// <para>
        /// <i>
        /// The following example demonstrates how to send a request to the machine and get a response using the various different Send method overrides.
        /// </i>
        /// </para>
        /// <code lang="C#" source="../Tango.FSE.Procedures/Examples/Send/Program.cs" title="Send a request" region="Example" />
        /// </example>
        T Send<T>(IMessage message, int? timeout = null) where T : class, IMessage;

        /// <summary>
        /// Sends the specified continuous request message.
        /// </summary>
        /// <typeparam name="T">Type of expected continuous response message.</typeparam>
        /// <param name="message">Request message instance.</param>
        /// <param name="callback">Specify a callback method to handle the incoming response messages.</param>
        /// <param name="timeout">First and continuous request timeout in seconds. (leave empty to get the default timeout)</param>
        /// <example>
        /// <para>
        /// <i>
        /// The following example demonstrates how to send a continuous request to the machine and get a continuous response using the various different SendContinuous method overrides.
        /// </i>
        /// </para>
        /// <code lang="C#" source="../Tango.FSE.Procedures/Examples/SendContinuous/Program.cs" title="Send a continuous request" region="Example" />
        /// </example>
        void SendContinuous<T>(IMessage message, Action<T> callback, int? timeout) where T : class, IMessage;

        /// <summary>
        /// Sends a continuous request message with optional timeout and comma separated arguments.
        /// </summary>
        /// <remarks>
        /// This method accepts only stub messages.
        /// </remarks>
        /// <typeparam name="T">Type of expected continuous response message.</typeparam>
        /// <param name="messageName">Full or shortened name of the message (e.g "CalculateRequest" or "calculate").</param>
        /// <param name="callback">Specify a callback method to handle the incoming response messages.</param>
        /// <param name="timeout">First and continuous request timeout in seconds. (leave empty to get the default timeout)</param>
        /// <param name="args">Request arguments separated by commas.</param>
        /// <example>
        /// <para>
        /// <i>
        /// The following example demonstrates how to send a continuous request to the machine and get a continuous response using the various different SendContinuous method overrides.
        /// </i>
        /// </para>
        /// <code lang="C#" source="../Tango.FSE.Procedures/Examples/SendContinuous/Program.cs" title="Send a continuous request" region="Example" />
        /// </example>
        void SendContinuous<T>(String messageName, Action<T> callback, TimeSpan? timeout, params Object[] args) where T : class, IMessage;

        /// <summary>
        /// Sends a continuous request message with optional timeout and comma separated arguments.
        /// </summary>
        /// <remarks>
        /// This method accepts only stub messages.
        /// </remarks>
        /// <typeparam name="T">Type of expected continuous response message.</typeparam>
        /// <param name="messageName">Full or shortened name of the message (e.g "CalculateRequest" or "calculate").</param>
        /// <param name="callback">Specify a callback method to handle the incoming response messages.</param>
        /// <param name="args">Request arguments separated by commas.</param>
        /// <example>
        /// <para>
        /// <i>
        /// The following example demonstrates how to send a continuous request to the machine and get a continuous response using the various different SendContinuous method overrides.
        /// </i>
        /// </para>
        /// <code lang="C#" source="../Tango.FSE.Procedures/Examples/SendContinuous/Program.cs" title="Send a continuous request" region="Example" />
        /// </example>
        void SendContinuous<T>(String messageName, Action<T> callback, params Object[] args) where T : class, IMessage;

        /// <summary>
        /// Writes the specified object string representation to the output window.
        /// </summary>
        /// <param name="obj">The object.</param>
        void WriteLine(Object obj);

        /// <summary>
        /// Writes a carriage return to the output window.
        /// </summary>
        void WriteLine();

        /// <summary>
        /// Writes the specified object string representation to the output window.
        /// </summary>
        /// <param name="obj">The object.</param>
        void Write(Object obj);

        /// <summary>
        /// Writes the hexadecimal representation of the specified object to the output window.
        /// </summary>
        /// <param name="number">The number.</param>
        /// <param name="digits">The digits.</param>
        void WriteLineHex(Object number, int digits);

        /// <summary>
        /// Writes the hexadecimal representation of the specified object to the output window.
        /// </summary>
        /// <param name="number">The number.</param>
        /// <param name="digits">The digits.</param>
        void WriteHex(Object number, int digits);

        /// <summary>
        /// Writes the specified array to the output window using the specified parsing style.
        /// </summary>
        /// <param name="array">The array.</param>
        /// <param name="style">Array parsing style.</param>
        void WriteLineArray(IEnumerable array, ArrayParsingStyle style);

        /// <summary>
        /// Reads the specified file as string.
        /// </summary>
        /// <param name="path">The file path.</param>
        /// <returns>The file text content.</returns>
        String GetFileText(String path);

        /// <summary>
        /// Read the specified file bytes.
        /// </summary>
        /// <param name="path">The file path.</param>
        /// <returns>The file byte array.</returns>
        byte[] GetFileBytes(String path);

        /// <summary>
        /// Clears the output window.
        /// </summary>
        void Clear();

        /// <summary>
        /// Writes a string to the specified file.
        /// If the file already exists it will be overwritten.
        /// </summary>
        /// <param name="filePath">The file path.</param>
        /// <param name="content">The content.</param>
        void WriteToFile(String filePath, String content);

        /// <summary>
        /// Appends the string content to the specified file.
        /// </summary>
        /// <param name="filePath">The file path.</param>
        /// <param name="content">The content.</param>
        void AppendToFile(String filePath, String content);

        /// <summary>
        /// Get the value of a user input by key.
        /// </summary>
        /// <typeparam name="T">Type of expected value.</typeparam>
        /// <param name="key">The input key.</param>
        /// <returns>The input value.</returns>
        T GetInput<T>(String key);

        /// <summary>
        /// Gets the value of a user input as an array.
        /// User input must be a comma separated string.
        /// </summary>
        /// <typeparam name="T">Type of expected values.</typeparam>
        /// <param name="key">The input key.</param>
        /// <returns>List containing the input array.</returns>
        List<T> GetInputArray<T>(String key);

        /// <summary>
        /// Get the value of a user input by key.
        /// </summary>
        /// <param name="key">The input key.</param>
        /// <returns>The input value.</returns>
        Object GetInput(String key);

        /// <summary>
        /// Fails the procedure with the specified error message.
        /// </summary>
        /// <param name="message">The error message.</param>
        void Fail(String message);

        /// <summary>
        /// Displays an information message to the user.
        /// </summary>
        /// <param name="message">The message.</param>
        void ShowInfo(String message);

        /// <summary>
        /// Displays a warning message to the user.
        /// </summary>
        /// <param name="message">The message.</param>
        void ShowWarning(String message);

        /// <summary>
        /// Displays an error message to the user.
        /// </summary>
        /// <param name="message">The message.</param>
        void ShowError(String message);

        /// <summary>
        /// Present the user with a question an returns a value indicating the confirmation.
        /// </summary>
        /// <param name="message">The message.</param>
        /// <returns></returns>
        bool ShowQuestion(String message);

        /// <summary>
        /// Presents the user with a warning and returns a value indicating the confirmation.
        /// </summary>
        /// <param name="message">The message.</param>
        /// <returns></returns>
        bool ShowWarningQuestion(String message);

        /// <summary>
        /// Displays an information message to the remote user.
        /// </summary>
        /// <param name="message">The message.</param>
        /// <param name="timeout">Timeout in seconds.</param>
        void ShowInfoRemote(String message, int timeout);

        /// <summary>
        /// Displays a warning message to the remote user.
        /// </summary>
        /// <param name="message">The message.</param>
        /// <param name="timeout">Timeout in seconds.</param>
        void ShowWarningRemote(String message, int timeout);

        /// <summary>
        /// Displays an error message to the remote user.
        /// </summary>
        /// <param name="message">The message.</param>
        /// <param name="timeout">Timeout in seconds.</param>
        void ShowErrorRemote(String message, int timeout);

        /// <summary>
        /// Present the remote user with a question an returns a value indicating the confirmation.
        /// </summary>
        /// <param name="message">The message.</param>
        /// <param name="timeout">Timeout in seconds.</param>
        /// <returns></returns>
        bool ShowQuestionRemote(String message, int timeout);

        /// <summary>
        /// Request user input for the specified primitive or complex type (model).
        /// </summary>
        /// <typeparam name="T">Type of input (primitive or complex)</typeparam>
        /// <param name="title">The request title.</param>
        /// <param name="message">The request message.</param>
        /// <returns>Request result of type T.</returns>
        /// <example>
        /// <para>
        /// <i>
        /// The following example demonstrates how to create a model and request the user to fill or modify that model.
        /// The model can contain primitives, arrays (comma separated), enums and booleans.
        /// </i>
        /// </para>
        /// <code lang="C#" source="../Tango.FSE.Procedures/Examples/RequestUserInputFor/Program.cs" title="Request user input" region="Example" />
        /// </example>
        T RequestUserInputFor<T>(String title, String message);

        /// <summary>
        /// Request a user input for the specified primitive or complex type (model).
        /// </summary>
        /// <typeparam name="T">Type of input (primitive or complex)</typeparam>
        /// <param name="model">Existing model (default values).</param>
        /// <param name="title">The request title.</param>
        /// <param name="message">The request message.</param>
        /// <returns>Request result of type T.</returns>
        /// <example>
        /// <para>
        /// <i>
        /// The following example demonstrates how to create a model and request the user to fill or modify that model.
        /// The model can contain primitives, arrays (comma separated), enums and booleans.
        /// </i>
        /// </para>
        /// <code lang="C#" source="../Tango.FSE.Procedures/Examples/RequestUserInputFor/Program.cs" title="Request user input" region="Example" />
        /// </example>
        T RequestUserInputFor<T>(T model, String title, String message);

        /// <summary>
        /// Requests a file selection from the user.
        /// </summary>
        /// <param name="message">The message.</param>
        /// <param name="extension">Extension filter (default "*.*").</param>
        /// <returns>The full path to the selected file or null if user canceled.</returns>
        String RequestFileOpen(String message, String extension = "*.*");

        /// <summary>
        /// Requests a file save location from the user.
        /// </summary>
        /// <param name="message">The message.</param>
        /// <param name="extension">Extension filter (default "*.*").</param>
        /// <param name="defaultFileName">Optional default file name.</param>
        /// <returns>The full path to the selected file or null if user canceled.</returns>
        String RequestFileSave(String message, String extension = "*.*", String defaultFileName = null);

        /// <summary>
        /// Requests a folder path from the user.
        /// </summary>
        /// <param name="message">The message.</param>
        /// <returns></returns>
        String RequestFolderSelect(String message);

        /// <summary>
        /// Updates the procedure user progress.
        /// </summary>
        /// <param name="message">The progress message.</param>
        /// <param name="isIndeterminate">Is the progress indeterminate (no need to set value and max).</param>
        /// <param name="value">The progress value.</param>
        /// <param name="maximum">The maximum progress.</param>
        void UpdateProgress(String message, bool isIndeterminate = true, double value = 0, double maximum = 100);

        /// <summary>
        /// Gets the current diagnostics package.
        /// </summary>
        /// <param name="waitForNext">Blocks the execution until a fresh diagnostics frame is available.
        /// This will guarantee that you will get a distinct package each time.
        /// </param>
        /// <returns>The diagnostics package.</returns>
        /// <example>
        /// <para>
        /// <i>
        /// The following example demonstrates how to collect 100 middle dancer samples and plot them as a graph result.
        /// </i>
        /// </para>
        /// <code lang="C#" source="../Tango.FSE.Procedures/Examples/Diagnostics/Program.cs" title="Collect dancer samples" region="Example" />
        /// </example>
        /// <seealso cref="AddGraphResult(ResultType, string, IEnumerable{double})"/>
        DiagnosticsPackage GetDiagnosticsPackage(bool waitForNext = false);

        /// <summary>
        /// Pauses the procedure execution for the specified time in milliseconds.
        /// </summary>
        /// <param name="milliseconds">Milliseconds.</param>
        void Sleep(int milliseconds);

        /// <summary>
        /// Runs the specified action asynchronously.
        /// </summary>
        /// <param name="action">The action.</param>
        /// <returns>The thread instance that has been created for the task.</returns>
        Thread RunAsync(Action action);

        /// <summary>
        /// Loads the specified procedure dialog on the main UI thread as a standard FSE dialog.
        /// </summary>
        /// <param name="name">The name of the dialog file.</param>
        /// <returns>The dialog controller.</returns>
        IDialogController LoadDialog(String name);

        /// <summary>
        /// Loads the specified procedure dialog as a window on the current thread.
        /// </summary>
        /// <param name="name">The name of the dialog.</param>
        /// <param name="windowTitle">The window title.</param>
        /// <returns>The dialog controller.</returns>
        IDialogWindowController LoadDialogAsWindow(String name, String windowTitle);

        /// <summary>
        /// Gets the type of the current machine connection.
        /// It is recommended to use <see cref="IsConnected"/> before, to ensure active machine connection.
        /// </summary>
        /// <example>
        /// <para>
        /// <i>
        /// The following example demonstrates how to check for valid machine connection, check the connection type and get the connected machine's serial number.
        /// </i>
        /// </para>
        /// <code lang="C#" source="../Tango.FSE.Procedures/Examples/Connection/Program.cs" title="Validate connection" region="Example" />
        /// </example>
        MachineConnectionTypes ConnectionType { get; }

        /// <summary>
        /// Gets or sets a value indicating whether a machine is currently connected.
        /// </summary>
        /// <example>
        /// <para>
        /// <i>
        /// The following example demonstrates how to check for valid machine connection, check the connection type and get the connected machine's serial number.
        /// </i>
        /// </para>
        /// <code lang="C#" source="../Tango.FSE.Procedures/Examples/Connection/Program.cs" title="Validate connection" region="Example" />
        /// </example>
        bool IsConnected { get; }

        /// <summary>
        /// Gets the currently connected machine entity.
        /// </summary>
        /// <example>
        /// <para>
        /// <i>
        /// The following example demonstrates how to check for valid machine connection, check the connection type and get the connected machine's serial number.
        /// </i>
        /// </para>
        /// <code lang="C#" source="../Tango.FSE.Procedures/Examples/Connection/Program.cs" title="Validate connection" region="Example" />
        /// </example>
        Machine ConnectedMachine { get; }

        /// <summary>
        /// Gets the specified service of type T from the global Tango FSE IOC container..
        /// </summary>
        /// <typeparam name="T">Type of service</typeparam>
        /// <returns>The service instance.</returns>
        T GetService<T>();

        /// <summary>
        /// Gets the specified resource as byte array.
        /// </summary>
        /// <param name="resourceName">Name of the resource.</param>
        /// <returns>Resource bytes.</returns>
        byte[] GetResourceBytes(String resourceName);

        /// <summary>
        /// Gets the specified resource as UTF-8 string.
        /// </summary>
        /// <param name="resourceName">Name of the resource.</param>
        /// <returns>Resource text.</returns>
        String GetResourceString(String resourceName);

        /// <summary>
        /// Copies the specified resource to a temporary path and opens it using the default windows application.
        /// </summary>
        /// <param name="resourceName">Name of the resource.</param>
        void OpenResource(String resourceName);

        /// <summary>
        /// Gets the specified procedure variable value.
        /// </summary>
        /// <param name="name">The name of the variable.</param>
        /// <returns>The variable value.</returns>
        Object GetVariable(String name);

        /// <summary>
        /// Gets the specified procedure variable value.
        /// </summary>
        /// <typeparam name="T">Type of expected variable value.</typeparam>
        /// <param name="name">The name of the variable.</param>
        /// <returns>The variable value of type T.</returns>
        T GetVariable<T>(String name);

        /// <summary>
        /// Gets the specified procedure variable value as an array.
        /// Value must be a comma separated string.
        /// </summary>
        /// <param name="name">The name of the variable.</param>
        /// <returns>List containing the variable values.</returns>
        List<T> GetVariableArray<T>(String name);

        /// <summary>
        /// Reads the specified csv file to a list of type T.
        /// The given type T model must contain properties not fields.
        /// </summary>
        /// <typeparam name="T">CSV model type.</typeparam>
        /// <param name="file">The file path.</param>
        /// <returns>A list containing all the CSV rows as models of type T.</returns>
        /// <example>
        /// <para>
        /// <i>
        /// The following example demonstrates CSV file writing and reading.
        /// The csv reading method also accepts a byte array so you can also read a CSV file from a procedure resource.
        /// </i>
        /// </para>
        /// <code lang="C#" source="../Tango.FSE.Procedures/Examples/Csv/Program.cs" title="Read/Write CSV" region="Example" />
        /// </example>
        List<T> ReadCsv<T>(String file) where T : class, new();

        /// <summary>
        /// Reads the specified csv byte array to a list of type T.
        /// The given type T model must contain properties not fields.
        /// </summary>
        /// <typeparam name="T">CSV model type.</typeparam>
        /// <param name="data">The byte array.</param>
        /// <returns>A list containing all the CSV rows as models of type T.</returns>
        /// <example>
        /// <para>
        /// <i>
        /// The following example demonstrates CSV file writing and reading.
        /// The csv reading method also accepts a byte array so you can also read a CSV file from a procedure resource.
        /// </i>
        /// </para>
        /// <code lang="C#" source="../Tango.FSE.Procedures/Examples/Csv/Program.cs" title="Read/Write CSV" region="Example" />
        /// </example>
        List<T> ReadCsv<T>(byte[] data) where T : class, new();

        /// <summary>
        /// Writes a CSV file to the specified file.
        /// The given type T model must contain properties not fields.
        /// </summary>
        /// <typeparam name="T">CSV model type.</typeparam>
        /// <param name="file">The output file path.</param>
        /// <param name="items">The items to write.</param>
        /// <example>
        /// <para>
        /// <i>
        /// The following example demonstrates CSV file writing and reading.
        /// The csv reading method also accepts a byte array so you can also read a CSV file from a procedure resource.
        /// </i>
        /// </para>
        /// <code lang="C#" source="../Tango.FSE.Procedures/Examples/Csv/Program.cs" title="Read/Write CSV" region="Example" />
        /// </example>
        void WriteCsv<T>(String file, List<T> items);

        /// <summary>
        /// Gets the remote data store manager.
        /// </summary>
        /// <returns></returns>
        IRemoteDataStoreManager GetRemoteDataStoreManager();

        /// <summary>
        /// Request a breakpoint operation from the host IDE (internal use only).
        /// </summary>
        /// <param name="file">The file.</param>
        /// <param name="lineNumber">The line number.</param>
        /// <param name="symbolsMap">The symbols map.</param>
        [HideIntellisense]
        void BreakPoint(String file, int lineNumber, params Object[] symbolsMap);

        /// <summary>
        /// Gets or sets the optional exit action for this script.
        /// </summary>
        [HideIntellisense]
        Action<IProcedureContext> OnExitAction { get; set; }
    }
}