Chronos Plugins 5.9.0
This documentation covers the plugin interfaces definitions and an example implementation.
Loading...
Searching...
No Matches
MiscInterfaces.cs
Go to the documentation of this file.
1using System;
2using System.Collections.Generic;
3using System.Reflection;
4using System.Runtime.InteropServices;
5using System.Threading.Tasks;
6// ReSharper disable InconsistentNaming
7
9{
17 [Guid("E354519C-F138-4C2E-85CA-122D58C2F424")]
18 public interface IHaveRunlogOutput
19 {
26 event Action<string> WriteToRunlog;
27 }
28
32 [Guid("1FDD6279-95C7-4AD2-8B9C-B5C3998C3B40")]
33 public interface IReactOnCultureChanges
34 {
41 void UICultureChanged(System.Globalization.CultureInfo newCulture);
42 }
43
47 public class TraceWriteEventArgs : EventArgs
48 {
52 public virtual string TextToWrite { get; }
53
58 public TraceWriteEventArgs(string someText)
59 {
60 TextToWrite = someText;
61 }
62 }
63
67 [Guid("E3B9ECED-7495-4151-9E00-7268749F5DD3")]
68 public interface ITraceLogger
69 {
73 event EventHandler<TraceWriteEventArgs> TraceWrite;
74 }
75
76 #region Schedule state awareness
77
81 public enum ScheduleState
82 {
91
95 Ended,
100 }
101
105 public abstract class ScheduleStateEventArgs : EventArgs
106 {
110 public abstract ScheduleState State { get; }
111
119 public abstract Guid PlanerID { get; }
120
124 public abstract string PlanerName { get; }
128 public abstract string AbortReason { get; }
129 }
130
134 public interface IScheduleEvents
135 {
139 event EventHandler<ScheduleStateEventArgs> ScheduleStateChanged;
140 }
141
148 public interface IScheduleStateAware
149 {
154 }
155
156 #endregion
157
158 #region Embedding of methods
159
163 public class MethodLaunchEventArgs : EventArgs
164 {
168 public string Method { get; set; }
169 }
170
178 public interface IEmbedMethods
179 {
188 Func<MethodLaunchEventArgs, Task> CreatePlanerFromMethod { set; }
189 }
190
191 #endregion
192
200 [AttributeUsage(AttributeTargets.Property|AttributeTargets.Method)]
201 public class DynamicPropertyMasterAttribute : Attribute
202 {
203 }
204
213 [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property)]
214 public class SortPriorityAttribute : Attribute
215 {
219 public int Priority { get; }
224 public SortPriorityAttribute(int pri)
225 {
226 Priority = pri;
227 }
228 }
229
233 [AttributeUsage(AttributeTargets.Assembly)]
234 public abstract class LicenseCheckerAttribute : Attribute
235 {
243 public abstract string CheckLicense();
244 }
245
249 public class RequiresAdvancedAttribute : Attribute
250 { }
251
255 [AttributeUsage(AttributeTargets.Class)]
256 public class NoPluginAttribute : Attribute
257 {
258 }
259
263 public interface IProvideDiagnosticLogs
264 {
268 IEnumerable<string> LogPaths { get; }
269 }
270
274 public interface IStopRuns
275 {
279 Func<StopRunArgs, Task> StopRun { set; }
280 }
281
289 public interface IPluginAdapter<out TPluginInterface> where TPluginInterface : class
290 {
294 TPluginInterface Plugin { get; }
295 }
296
300 public class StopRunArgs
301 {
305 public enum StopMode
306 {
318 }
319
323 public StopMode How { get; set; }
327 public bool RestartRemainingJobs { get; set; }
331 public bool StopQueue { get; set; }
335 public string Reason { get; set; }
339 public bool RunErrorMethod { get; set; }
340 }
341
348 public interface IColumnInfo
349 {
353 string Name { get; }
357 string Token { get; }
365 IReadOnlyList<string> StandardItems { get; }
372 string StandardValue { get; }
373 }
374
381 public interface ILoadPathExtender
382 {
387 public void AddPath(string folderForAssemblies);
388
396 public void ForbidRedirection(string assemblyBaseName);
397 }
398}
Classes and interfaces that are meant for plugins. The classes and interfaces below this namespace ar...
@ Ended
After the last task finished or an error occurred, but before autosamplers are disconnected.
@ Validated
Validation was completed.
@ Starting
Before the first task is executed.
@ SamplersStopped
After all autosamplers have been stopped.
Implement this interface if you have messages for our run log.
Action< string > WriteToRunlog
Use this event to send output to the Run Control / Runlog page and, if applicable,...
Allows you to support runtime language switching just like Chronos does.
void UICultureChanged(System.Globalization.CultureInfo newCulture)
This method will be called when the current language in Chronos changes.
For future extension (categories, priorities...)
TraceWriteEventArgs(string someText)
Currently just takes some text which is written to the trace log.
virtual string TextToWrite
Text that should be written to the trace log.
Writes some text to the trace log.
EventHandler< TraceWriteEventArgs > TraceWrite
Chronos will subscribe to this event and log the text provided in the event args.
Information about the current state change.
string AbortReason
Contains the error message in case the schedule was aborted because of an error.
Guid PlanerID
To avoid confusion between different planners.
string PlanerName
If you need to identify the planer to the user, use this.
ScheduleState State
The state that was entered.
Currently starting schedule stage.
EventHandler< ScheduleStateEventArgs > ScheduleStateChanged
Notification about schedule state changes.
Implement this interface if you need to track the state of schedules.
IScheduleEvents ScheduleEvents
Hook up immediately or save this for later use.
Could be extended in the future if e.g. arguments should be passed to the method running task planer.
string Method
Full path to the method or a path relative to the embedding task's method.
Implement this interface if you want to run a method from within your task.
Func< MethodLaunchEventArgs, Task > CreatePlanerFromMethod
Call this function to create a task planer containing a single method from your code.
Set this attribute if changing its value in the method editor will result in a different list of prop...
Override the normal sort priority in the method editor.
SortPriorityAttribute(int pri)
Give the decorated element a sort priority.
int Priority
Higher means further down the list in the method editor.
Use this attribute if you want to expose the contents of your plugin assembly only after a license ch...
string CheckLicense()
Do the license check.
If this attribute is present, the respective class is not available in Chronos XT.
Decorate your class with this attribute if it formally looks like some plugin component,...
This can be called for a sample list worker or device that writes its own set of log files which shou...
IEnumerable< string > LogPaths
Provide full paths to each of your log files here.
Implement this interface with your device or sample list worker to get fine-grained control about sto...
Func< StopRunArgs, Task > StopRun
Callback function returning a task that completes once the schedule queue was stopped.
Generic way to access a plugin object that was wrapped by Chronos.
TPluginInterface Plugin
Get the inner, plugin defined part of the object.
Options for stopping the schedule/queue.
StopMode
Details how to stop the run.
@ NoNewJobs
Do not interrupt jobs that were already started.
bool RestartRemainingJobs
In case of a soft stop, should the unstarted jobs be scheduled for a later restart?
StopMode How
Specify how the run should be stopped.
bool RunErrorMethod
For immediate stop, try to run the error method first.
string Reason
Optional reason for the stop.
bool StopQueue
Do not start any other schedules after the current one was stopped.
Information about a column defined in a method.
string Token
Column token as used in the method.
string Name
Column name as defined in the method editor.
string StandardValue
The standard value (if any), as entered in the method editor.
IReadOnlyList< string > StandardItems
For columns that provide a list of possible values.
Allows loading assemblies from specific paths.
void AddPath(string folderForAssemblies)
Add a path to a folder where additional assemblies are located.
void ForbidRedirection(string assemblyBaseName)
If an assembly can't be found, Chronos usually tries to let your code find the required type in Chron...