Chronos Plugins 5.9.0
This documentation covers the plugin interfaces definitions and an example implementation.
Loading...
Searching...
No Matches
MockPlugin.Tasks.MockDynamicPropsDependingOnDevice Class Reference

This task demonstrates how to make the property list depend on the picked autosampler. More...

+ Inheritance diagram for MockPlugin.Tasks.MockDynamicPropsDependingOnDevice:
+ Collaboration diagram for MockPlugin.Tasks.MockDynamicPropsDependingOnDevice:

Classes

class  MyPropertyDescriptor
 Just a dynamic property named after the picked autosampler. The value is just redirected to the mDynPropValue of the task. More...
 

Public Member Functions

void PreValidate ()
 Called before the schedule construction is completed.
 
void PostValidate ()
 Called after the schedule construction is completed.
 
void Execute ()
 Do whatever you have to do with your parameters.
 
string GetTaskAction ()
 Description of the tasks's action (for hints/time table)
 
void SetDevice (IDevice yourDevice)
 Will be called by chronos when building the schedule.
 
void PropertyEdited (string propName, object propValue)
 This will be called as soon as a property was changed in the method editor.
 
override PropertyDescriptorCollection GetProperties ()
 
override object GetPropertyOwner (PropertyDescriptor pd)
 
void PreValidate ()
 Called before the schedule construction is completed.
 
void PostValidate ()
 Called after the schedule construction is completed.
 
void Execute ()
 Do whatever you have to do with your parameters.
 
string GetTaskAction ()
 Description of the tasks's action (for hints/time table)
 
void SetDevice (IDevice yourDevice)
 React to a picked device.
 
void PropertyEdited (string propName, object propValue)
 This gets called by Chronos if there's some new text in the method editor, but Chronos could not find a matching device.
 
override PropertyDescriptorCollection GetProperties ()
 
override object GetPropertyOwner (PropertyDescriptor pd)
 
- Public Member Functions inherited from AxelSemrau.Chronos.Plugin.ITaskForDevice
- Public Member Functions inherited from AxelSemrau.Chronos.Plugin.ITask
- Public Member Functions inherited from AxelSemrau.Chronos.Plugin.IWantEditorUpdates

Private Attributes

string mDevName
 
string mDynPropValue
 
IDevice mDevice
 

Static Private Attributes

const string NoDevice = "No device"
 

Detailed Description

This task demonstrates how to make the property list depend on the picked autosampler.

The task has one dynamic property that is named after the picked autosampler.

Definition at line 14 of file Tasks/MockDynamicPropsDependingOnDevice.cs.

Member Function Documentation

◆ Execute() [1/2]

void MockPlugin.Tasks.MockDynamicPropsDependingOnDevice.Execute ( )

Do whatever you have to do with your parameters.

Implements AxelSemrau.Chronos.Plugin.ITask.

Definition at line 26 of file MockDynamicPropsDependingOnDevice.cs.

27 {
28 }

◆ Execute() [2/2]

void MockPlugin.Tasks.MockDynamicPropsDependingOnDevice.Execute ( )

Do whatever you have to do with your parameters.

Implements AxelSemrau.Chronos.Plugin.ITask.

Definition at line 31 of file Tasks/MockDynamicPropsDependingOnDevice.cs.

32 {
33 }

◆ GetProperties() [1/2]

override PropertyDescriptorCollection MockPlugin.Tasks.MockDynamicPropsDependingOnDevice.GetProperties ( )

Definition at line 57 of file MockDynamicPropsDependingOnDevice.cs.

58 {
59 var dynProp = new MyPropertyDescriptor(this);
60 return new PropertyDescriptorCollection(new PropertyDescriptor[]{dynProp});
61 }

◆ GetProperties() [2/2]

override PropertyDescriptorCollection MockPlugin.Tasks.MockDynamicPropsDependingOnDevice.GetProperties ( )

Definition at line 73 of file Tasks/MockDynamicPropsDependingOnDevice.cs.

74 {
75 var dynProp = new MyPropertyDescriptor(this);
76 return new PropertyDescriptorCollection(new PropertyDescriptor[]{dynProp});
77 }

◆ GetPropertyOwner() [1/2]

override object MockPlugin.Tasks.MockDynamicPropsDependingOnDevice.GetPropertyOwner ( PropertyDescriptor pd)

Definition at line 63 of file MockDynamicPropsDependingOnDevice.cs.

64 {
65 return pd is MyPropertyDescriptor ? this : null;
66 }

◆ GetPropertyOwner() [2/2]

override object MockPlugin.Tasks.MockDynamicPropsDependingOnDevice.GetPropertyOwner ( PropertyDescriptor pd)

Definition at line 79 of file Tasks/MockDynamicPropsDependingOnDevice.cs.

80 {
81 return pd is MyPropertyDescriptor ? this : null;
82 }

◆ GetTaskAction() [1/2]

string MockPlugin.Tasks.MockDynamicPropsDependingOnDevice.GetTaskAction ( )

Description of the tasks's action (for hints/time table)

Implements AxelSemrau.Chronos.Plugin.ITask.

◆ GetTaskAction() [2/2]

string MockPlugin.Tasks.MockDynamicPropsDependingOnDevice.GetTaskAction ( )

Description of the tasks's action (for hints/time table)

Implements AxelSemrau.Chronos.Plugin.ITask.

◆ PostValidate() [1/2]

void MockPlugin.Tasks.MockDynamicPropsDependingOnDevice.PostValidate ( )

Called after the schedule construction is completed.

Implements AxelSemrau.Chronos.Plugin.ITask.

Definition at line 22 of file MockDynamicPropsDependingOnDevice.cs.

23 {
24 }

◆ PostValidate() [2/2]

void MockPlugin.Tasks.MockDynamicPropsDependingOnDevice.PostValidate ( )

Called after the schedule construction is completed.

Implements AxelSemrau.Chronos.Plugin.ITask.

Definition at line 27 of file Tasks/MockDynamicPropsDependingOnDevice.cs.

28 {
29 }

◆ PreValidate() [1/2]

void MockPlugin.Tasks.MockDynamicPropsDependingOnDevice.PreValidate ( )

Called before the schedule construction is completed.

Implements AxelSemrau.Chronos.Plugin.ITask.

Definition at line 18 of file MockDynamicPropsDependingOnDevice.cs.

19 {
20 }

◆ PreValidate() [2/2]

void MockPlugin.Tasks.MockDynamicPropsDependingOnDevice.PreValidate ( )

Called before the schedule construction is completed.

Implements AxelSemrau.Chronos.Plugin.ITask.

Definition at line 23 of file Tasks/MockDynamicPropsDependingOnDevice.cs.

24 {
25 }

◆ PropertyEdited() [1/2]

void MockPlugin.Tasks.MockDynamicPropsDependingOnDevice.PropertyEdited ( string propName,
object propValue )

This will be called as soon as a property was changed in the method editor.

Parameters
propName
propValue

Implements AxelSemrau.Chronos.Plugin.IWantEditorUpdates.

Definition at line 44 of file MockDynamicPropsDependingOnDevice.cs.

45 {
46 if (propName == "Autosampler")
47 {
48 var newDevName = ((propValue as IDevice)?.Name) ?? NoDevice;
49 if (mDevName != newDevName)
50 {
51 mDevName = newDevName;
52 TypeDescriptor.Refresh(this);
53 }
54 }
55 }
To be implemented by the "device driver" part of a Chronos plugin.

References MockPlugin.Tasks.MockDynamicPropsDependingOnDevice.mDevName, and MockPlugin.Tasks.MockDynamicPropsDependingOnDevice.NoDevice.

Referenced by MockPlugin.Tasks.MockDynamicPropsDependingOnDevice.SetDevice().

◆ PropertyEdited() [2/2]

void MockPlugin.Tasks.MockDynamicPropsDependingOnDevice.PropertyEdited ( string propName,
object propValue )

This gets called by Chronos if there's some new text in the method editor, but Chronos could not find a matching device.

Parameters
propName
propValue

Implements AxelSemrau.Chronos.Plugin.IWantEditorUpdates.

Definition at line 60 of file Tasks/MockDynamicPropsDependingOnDevice.cs.

61 {
62 if (propName == "Autosampler")
63 {
64 var newDevName = ((propValue as IDevice)?.Name) ?? NoDevice;
65 if (mDevName != newDevName)
66 {
67 mDevName = newDevName;
68 TypeDescriptor.Refresh(this);
69 }
70 }
71 }

References MockPlugin.Tasks.MockDynamicPropsDependingOnDevice.mDevName, and MockPlugin.Tasks.MockDynamicPropsDependingOnDevice.NoDevice.

◆ SetDevice() [1/2]

void MockPlugin.Tasks.MockDynamicPropsDependingOnDevice.SetDevice ( IDevice yourDevice)

Will be called by chronos when building the schedule.

Parameters
yourDevice

Implements AxelSemrau.Chronos.Plugin.ITaskForDevice.

Definition at line 33 of file MockDynamicPropsDependingOnDevice.cs.

34 {
35 if (mDevice != yourDevice)
36 {
37 mDevice = yourDevice;
38 // The PropertyEdited handler is called by Chronos for texts that can not be converted to a device instance.
39 // Otherwise, we get the device set here. If so, we must react in the same way.
40 PropertyEdited("Autosampler",mDevice);
41 }
42 }
void PropertyEdited(string propName, object propValue)
This will be called as soon as a property was changed in the method editor.

References MockPlugin.Tasks.MockDynamicPropsDependingOnDevice.mDevice, and MockPlugin.Tasks.MockDynamicPropsDependingOnDevice.PropertyEdited().

◆ SetDevice() [2/2]

void MockPlugin.Tasks.MockDynamicPropsDependingOnDevice.SetDevice ( IDevice yourDevice)

React to a picked device.

Parameters
yourDevice

Implements AxelSemrau.Chronos.Plugin.ITaskForDevice.

Definition at line 44 of file Tasks/MockDynamicPropsDependingOnDevice.cs.

45 {
46 if (mDevice != yourDevice)
47 {
48 mDevice = yourDevice;
49 // The PropertyEdited handler is called by Chronos for texts that can not be converted to a device instance.
50 // Otherwise, we get the device set here. If so, we must react in the same way.
51 PropertyEdited("Autosampler",mDevice);
52 }
53 }

References MockPlugin.Tasks.MockDynamicPropsDependingOnDevice.mDevice, and MockPlugin.Tasks.MockDynamicPropsDependingOnDevice.PropertyEdited().

Member Data Documentation

◆ mDevice

IDevice MockPlugin.Tasks.MockDynamicPropsDependingOnDevice.mDevice
private

◆ mDevName

string MockPlugin.Tasks.MockDynamicPropsDependingOnDevice.mDevName
private

◆ mDynPropValue

string MockPlugin.Tasks.MockDynamicPropsDependingOnDevice.mDynPropValue
private

Definition at line 15 of file MockDynamicPropsDependingOnDevice.cs.

◆ NoDevice

const string MockPlugin.Tasks.MockDynamicPropsDependingOnDevice.NoDevice = "No device"
staticprivate

The documentation for this class was generated from the following files: