Chronos Plugins 5.9.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 {
20
26 {
27 mDeviceInfoProvider = infoProv;
28 }
29
30 #region Implementation of IWorkWithSampleLists
31
32 public string ButtonCaption => null;
33 public Icon ButtonIcon => null;
34 public void DoYourJob()
35 {
36 // nothing to see here
37 }
38
39 #endregion
40
41 #region Implementation of IDirectDeviceAccess
42
43 public IEnumerable<IDevice> ConfiguredDevices
44 {
45 set
46 {
47 // You could save the list for later use,
48 // you could filter the list for specific interfaces,
49 // you could call methods of the devices at any time -
50 // just make sure you know what you are doing and don't mess with
51 // toolboxes and sequence execution.
52 Trace("** Start device list dump");
53 foreach (var someDev in value)
54 {
55 Trace($"{someDev.Name} of type {someDev.GetType().FullName}, connection state {mDeviceInfoProvider.Single(info => info.Device == someDev).ConnectionState}");
56 }
57 Trace("** End device list dump");
58 }
59 }
60
61 #endregion
62
63 private void Trace(string txt)
64 {
65 TraceWrite?.Invoke(this,new TraceWriteEventArgs(txt));
66 }
67 #region Implementation of ITraceLogger
68
69 public event EventHandler<TraceWriteEventArgs> TraceWrite;
70
71 #endregion
72 }
73}
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.
Providing an opportunity for future extension. Made available via dependency injection.
Definition Helpers.cs:176
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.
readonly IDeviceInfoProvider mDeviceInfoProvider
EventHandler< TraceWriteEventArgs > TraceWrite
IEnumerable< IDevice > ConfiguredDevices
List of IDevice for all configured devices in Chronos.
DeviceSurveillance(IDeviceInfoProvider infoProv)
Requesting the device info provider via the constructor, not via "Helpers" - makes it easier to write...
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...