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

Shows how to get information about other tasks in the schedule. More...

Inheritance diagram for MockPlugin.Tasks.JobInspectionDemo:
Collaboration diagram for MockPlugin.Tasks.JobInspectionDemo:

Properties

IInspectJob INeedToInspectOtherTasks. JobInspector [set]
 The JobInspector lets you see information about other tasks and their properties.
JITCheckerDelegate JITChecker [set]
 Chronos will provide a function that you can use to check for JIT expressions in properties.

Private Member Functions

void ITask. PreValidate ()
 Called before the schedule construction is completed.
void DisablePreviousTwin ()
 Shows how you can disable other tasks in the schedule creation phase. If there's a previous JobInspectionDemo task, let's turn it off.
void ITask. PostValidate ()
 Called after the schedule construction is completed.
string GetJitInfo (ITaskInfo someTaskInfo, IAccessProperty somePropInfo)
void ITask. Execute ()
 Do whatever you have to do with your parameters.
string ITask. GetTaskAction ()
 Description of the tasks's action (for hints/time table)

Private Attributes

IInspectJob mJobInspector
JITCheckerDelegate mJitChecker

Detailed Description

Shows how to get information about other tasks in the schedule.

Definition at line 12 of file MockJobInspectingTask.cs.

Member Function Documentation

◆ DisablePreviousTwin()

void MockPlugin.Tasks.JobInspectionDemo.DisablePreviousTwin ( )
private

Shows how you can disable other tasks in the schedule creation phase. If there's a previous JobInspectionDemo task, let's turn it off.

Exceptions
System.NotImplementedException

Definition at line 30 of file MockJobInspectingTask.cs.

31 {
32 var prevTask = mJobInspector.CompleteSchedule
33 .TakeWhile(someTaskInfo => someTaskInfo.PluginTask != mJobInspector.CurrentTask.PluginTask).LastOrDefault();
34 if (prevTask?.PluginTask is JobInspectionDemo)
35 {
36 prevTask.Enabled = false;
37 }
38 }

References mJobInspector.

Referenced by PostValidate().

◆ Execute()

void ITask. MockPlugin.Tasks.JobInspectionDemo.Execute ( )
private

Do whatever you have to do with your parameters.

Implements AxelSemrau.Chronos.Plugin.ITask.

Definition at line 53 of file MockJobInspectingTask.cs.

54 {
55 var sb = new StringBuilder();
56 var i = 1;
57 foreach (var someTaskInfo in mJobInspector.JobsTasks)
58 {
59 sb.AppendLine($"Task {i++}");
60 sb.AppendFormat("Class {0}, {1} properties\r\n",
61 someTaskInfo.Task.GetType().Name,
62 someTaskInfo.PropertyAccessInfos.Count());
63 foreach (var somePropInfo in someTaskInfo.PropertyAccessInfos)
64 {
65 sb.AppendFormat("Property {0}: {1}, jit? {2}\r\n",
66 somePropInfo.PropInfo.Name,
67 somePropInfo.PropInfo.GetValue(somePropInfo.BaseObject, null),
68 GetJitInfo(someTaskInfo,somePropInfo));
69 }
70 sb.AppendLine();
71 }
72 System.Windows.Forms.MessageBox.Show(Helpers.Gui.MainWindow, sb.ToString(), "Checked other tasks");
73 }

References GetJitInfo(), AxelSemrau.Chronos.Plugin.Helpers.Gui, AxelSemrau.Chronos.Plugin.IGuiHelper.MainWindow, and mJobInspector.

◆ GetJitInfo()

string MockPlugin.Tasks.JobInspectionDemo.GetJitInfo ( ITaskInfo someTaskInfo,
IAccessProperty somePropInfo )
private

Definition at line 45 of file MockJobInspectingTask.cs.

46 {
47 if(mJitChecker == null)
48 {
49 return "N/A";
50 }
51 return mJitChecker(someTaskInfo.Task,somePropInfo.FullPath) ? "yes" : "no";
52 }
string FullPath
Full path, as must be given in property reference expressions.
object Task
Task object, Chronos internal type.

References AxelSemrau.Chronos.Plugin.IAccessProperty.FullPath, mJitChecker, and AxelSemrau.Chronos.Plugin.ITaskInfo.Task.

Referenced by Execute().

◆ GetTaskAction()

string ITask. MockPlugin.Tasks.JobInspectionDemo.GetTaskAction ( )
private

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

Implements AxelSemrau.Chronos.Plugin.ITask.

Definition at line 75 of file MockJobInspectingTask.cs.

76 {
77 return "Snooping around";
78 }

◆ PostValidate()

void ITask. MockPlugin.Tasks.JobInspectionDemo.PostValidate ( )
private

Called after the schedule construction is completed.

Implements AxelSemrau.Chronos.Plugin.ITask.

Definition at line 40 of file MockJobInspectingTask.cs.

41 {
42 DisablePreviousTwin();
43 }

References DisablePreviousTwin().

◆ PreValidate()

void ITask. MockPlugin.Tasks.JobInspectionDemo.PreValidate ( )
private

Called before the schedule construction is completed.

Implements AxelSemrau.Chronos.Plugin.ITask.

Definition at line 16 of file MockJobInspectingTask.cs.

17 {
18 if (mJitChecker != null)
19 {
20 System.Windows.Forms.MessageBox.Show(Helpers.Gui.MainWindow,
21 $"My enabled property {(mJitChecker(this, "Enabled") ? "will be set by a JIT expression" : "has an ordinary value")}", "JobInspectionDemo");
22 }
23 }

References AxelSemrau.Chronos.Plugin.Helpers.Gui, AxelSemrau.Chronos.Plugin.IGuiHelper.MainWindow, and mJitChecker.

Member Data Documentation

◆ mJitChecker

JITCheckerDelegate MockPlugin.Tasks.JobInspectionDemo.mJitChecker
private

Definition at line 94 of file MockJobInspectingTask.cs.

Referenced by GetJitInfo(), and PreValidate().

◆ mJobInspector

IInspectJob MockPlugin.Tasks.JobInspectionDemo.mJobInspector
private

Definition at line 84 of file MockJobInspectingTask.cs.

Referenced by DisablePreviousTwin(), and Execute().

Property Documentation

◆ JITChecker

JITCheckerDelegate MockPlugin.Tasks.JobInspectionDemo.JITChecker
set

Chronos will provide a function that you can use to check for JIT expressions in properties.

Implements AxelSemrau.Chronos.Plugin.INeedToCheckForJITLinks.

Definition at line 95 of file MockJobInspectingTask.cs.

95{ set => mJitChecker = value; }

◆ JobInspector

IInspectJob INeedToInspectOtherTasks. MockPlugin.Tasks.JobInspectionDemo.JobInspector
setprivate

The JobInspector lets you see information about other tasks and their properties.

Implements AxelSemrau.Chronos.Plugin.INeedToInspectOtherTasks.

Definition at line 86 of file MockJobInspectingTask.cs.

87 {
88 set => mJobInspector = value;
89 }

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