Chronos Plugins  5.2.0
This documentation covers the plugin interfaces definitions and an example implementation.
MockPlugin.Tasks.TaskListAttribute Class Reference

This attribute uses the task to which it is applied to query for other tasks in the method editor. The list of returned values is just a list of the tasks currently in the method editor. More...

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

Public Member Functions

override IEnumerable GetStandardValues (ITask theTask)
 Return the standard value list depending on the given task instance. More...
 

Private Member Functions

string GetCaffeineInfo (ITaskInEditorInfo editedTask)
 If this is a BrewFrappuccino task, we'll find out if it uses decaf coffee. More...
 

Detailed Description

This attribute uses the task to which it is applied to query for other tasks in the method editor. The list of returned values is just a list of the tasks currently in the method editor.

Definition at line 11 of file TaskListAttribute.cs.

Member Function Documentation

◆ GetCaffeineInfo()

string MockPlugin.Tasks.TaskListAttribute.GetCaffeineInfo ( ITaskInEditorInfo  editedTask)
private

If this is a BrewFrappuccino task, we'll find out if it uses decaf coffee.

Parameters
editedTask
Returns
Just a demonstration how you can inspect properties of other tasks that are not just plain text.

Definition at line 42 of file TaskListAttribute.cs.

43  {
44  if (editedTask.Task is IPluginTaskAdapter adapter && adapter.Plugin is BrewFrappuccino brewer)
45  {
46  return $", {(brewer.Composition.DeCaffeinated ? "" : "not ")} decaffeinated";
47  }
48  return "";
49  }
TPluginInterface Plugin
Get the inner, plugin defined part of the object.
Do not implement this interface.
object Task
Task object, Chronos internal type.

References AxelSemrau.Chronos.Plugin.IPluginAdapter< out out TPluginInterface >.Plugin, and AxelSemrau.Chronos.Plugin.ITaskInfo.Task.

◆ GetStandardValues()

override IEnumerable MockPlugin.Tasks.TaskListAttribute.GetStandardValues ( ITask  theTask)
virtual

Return the standard value list depending on the given task instance.

Parameters
theTask
Returns

Implements AxelSemrau.Chronos.Plugin.StandardValueProviderAttribute.

Definition at line 13 of file TaskListAttribute.cs.

14  {
15  if (theTask is IPluginTaskAdapter adapter && adapter.Plugin is MockMethodEditorSnoopingTask snooper)
16  {
17  var theSnooper = snooper.MethodEditorSnooper;
18  if (theSnooper != null)
19  {
20  foreach (var editedTask in snooper.MethodEditorSnooper.EditedTasks)
21  {
22  if (editedTask.Task == theTask)
23  {
24  yield return $"This task: {editedTask}";
25  }
26  else
27  {
28  yield return $"{editedTask}{GetCaffeineInfo(editedTask)}";
29  }
30  }
31  }
32  }
33  }

References AxelSemrau.Chronos.Plugin.IPluginAdapter< out out TPluginInterface >.Plugin.


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