2using System.Collections.Generic;
3using System.ComponentModel;
4using System.Diagnostics.CodeAnalysis;
6using System.Windows.Media;
15 [ScheduleDiagramColor(nameof(Colors.RoyalBlue))]
16 [SuppressMessage(
"ReSharper",
"UnusedMember.Global")]
19 #region ITask implementation, does nothing but show the parameter list in the time table
38 var sb =
new System.Text.StringBuilder();
49 return "No properties";
59 #endregion ITask implementation, does nothing but show the parameter list in the time table
64 private readonly Dictionary<string, object>
mPropsValues =
new Dictionary<string, object>();
69 mAttrs = TypeDescriptor.GetAttributes(
this, noCustomTypeDesc:
true);
71 var reflProp = TypeDescriptor.GetProperties(
this, noCustomTypeDesc:
true).Find(nameof(
PropCount),
false);
77 resProp.AddAttribute(
new ReadOnlyAttribute(
true));
84 #region Type descriptor implementation
120 base.FillAttributes(attributeList);
123 attributeList.Add(someAttr);
131 public override void SetValue(
object component,
object value)
168 return mProps.Contains(pd) ? this :
null;
183 #endregion Type descriptor implementation
185 private readonly List<PropertyDescriptor>
mProps =
new List<PropertyDescriptor>();
186 private readonly AttributeCollection
mAttrs;
189 [DynamicPropertyMaster]
209 TypeDescriptor.Refresh(
this);
Classes and interfaces that are meant for plugins. The classes and interfaces below this namespace ar...
Example task implementations. Since there are lots of things that can be done from a task,...
To be implemented by the "task" part of a Chronos plugin. Public properties of the implementing type ...
Use this on your task property if you want the method editor to show a default unit.
This task demonstrates how to use a custom type descriptor to implement a dynamic list of properties....
override object GetPropertyOwner(PropertyDescriptor pd)
Must be overridden, else you'll get NullRefrences when trying to work with the descriptor.
override PropertyDescriptorCollection GetProperties()
PropertyDescriptorCollection mPropDescColl
Caches the list resulting from set_PropCount.
void Execute()
Do whatever you have to do with your parameters.
string GetTaskAction()
Description of the tasks's action (for hints/time table)
readonly AttributeCollection mAttrs
override AttributeCollection GetAttributes()
readonly Dictionary< string, object > mPropsValues
Storage for fake property names and values.
void PostValidate()
Called after the schedule construction is completed.
void PreValidate()
Called before the schedule construction is completed.
readonly List< PropertyDescriptor > mProps
Member descriptor "implementation" - the defaults are ok for us.
MyMemberDescriptor(string name)
Custom property descriptor, redirecting get/set into our mPropsValues dictionary.
override void FillAttributes(System.Collections.IList attributeList)
override Type PropertyType
override void SetValue(object component, object value)
readonly List< Attribute > mExtraAttributes
override void ResetValue(object component)
override Type ComponentType
override bool CanResetValue(object component)
void AddAttribute(Attribute someAttr)
override bool ShouldSerializeValue(object component)
override object GetValue(object component)
MyPropertyDescriptor(string name, Type proptype, string unit=null)