Chronos Plugins 5.4.0
This documentation covers the plugin interfaces definitions and an example implementation.
Loading...
Searching...
No Matches
DeviceSurveillance.cs
Go to the documentation of this file.
1using System;
2using System.Collections.Generic;
3using System.Drawing;
4using System.Linq;
6
7namespace MockPlugin.Device
8{
16 // ReSharper disable once UnusedMember.Global
18 {
19 #region Implementation of IWorkWithSampleLists
20
21 public string ButtonCaption => null;
22 public Icon ButtonIcon => null;
23 public void DoYourJob()
24 {
25 // nothing to see here
26 }
27
28 #endregion
29
30 #region Implementation of IDirectDeviceAccess
31
32 public IEnumerable<IDevice> ConfiguredDevices
33 {
34 set
35 {
36 // You could save the list for later use,
37 // you could filter the list for specific interfaces,
38 // you could call methods of the devices at any time -
39 // just make sure you know what you are doing and don't mess with
40 // toolboxes and sequence execution.
41 Trace("** Start device list dump");
42 foreach (var someDev in value)
43 {
44 Trace($"{someDev.Name} of type {someDev.GetType().FullName}, connection state {Helpers.Devices.Single(info => info.Device == someDev).ConnectionState}");
45 }
46 Trace("** End device list dump");
47 }
48 }
49
50 #endregion
51
52 private void Trace(string txt)
53 {
54 TraceWrite?.Invoke(this,new TraceWriteEventArgs(txt));
55 }
56 #region Implementation of ITraceLogger
57
58 public event EventHandler<TraceWriteEventArgs> TraceWrite;
59
60 #endregion
61 }
62}
Classes and interfaces that are meant for plugins. The classes and interfaces below this namespace ar...
A fake device. This namespace contains the fake device driver and auxiliary classes for settings,...
Implement this interface if you need direct access to the list of configured devices.
For future extension (categories, priorities...)
Writes some text to the trace log.
For plugins that want to manipulate or run sample lists.
Shows how you can directly interact with all configured devices.
Icon ButtonIcon
Shown in the button, preferred size 22x22.
EventHandler< TraceWriteEventArgs > TraceWrite
IEnumerable< IDevice > ConfiguredDevices
List of IDevice for all configured devices in Chronos.
string ButtonCaption
Shown on the sample list page.
void DoYourJob()
Will be triggered when the user clicks on the button. The button will be disabled until you return fr...