Class WatchBaseAttribute
Inheritance
System.Object
WatchBaseAttribute
Assembly: Eco.Core.dll
Syntax
public abstract class WatchBaseAttribute : Attribute
Constructors
WatchBaseAttribute(Type, String, Boolean, String, Boolean, Type)
Declaration
protected WatchBaseAttribute(Type rootType, string memberName, bool watchAllMembers, string subMemberName, bool watchAllSubMembers, Type memberTypeMustDerive = null)
Parameters
Type |
Name |
Description |
System.Type |
rootType |
|
System.String |
memberName |
|
System.Boolean |
watchAllMembers |
|
System.String |
subMemberName |
|
System.Boolean |
watchAllSubMembers |
|
System.Type |
memberTypeMustDerive |
|
Fields
MemberName
Which property we're watching, or 'determine from context' if null.
Declaration
public readonly string MemberName
Field Value
Type |
Description |
System.String |
|
MemberTypeMustDerive
Only watch types that are derived from this specific class or interface.
Declaration
public readonly Type MemberTypeMustDerive
Field Value
Type |
Description |
System.Type |
|
OverridenType
This is used with TooltipAffectedByAttribute and specifically when watching an event on a method that has a NewTooltip attribute and an override type.
This can be removed when we move the NewTooltip to Eco.Core, which then we can just make a function as an extansion of System.Reflection.MethodInfo
which give us the real root type of that method (Detect whether that method has a NewTooltip attribute and return the Override property.
Declaration
public Type OverridenType
Field Value
Type |
Description |
System.Type |
|
SubMemberName
Which sub member we're watching, or none if null.
Declaration
public readonly string SubMemberName
Field Value
Type |
Description |
System.String |
|
WatchAllMembers
If set, ignore the SubPropName and instead watch all properties on the root.
Declaration
public readonly bool WatchAllMembers
Field Value
Type |
Description |
System.Boolean |
|
WatchAllSubMembers
If set, ignore the SubMemberName and watch all sub properties.
Declaration
public readonly bool WatchAllSubMembers
Field Value
Type |
Description |
System.Boolean |
|
Methods
GetCallback(MemberInfo, out Type)
Child class must define what this does.
Declaration
public abstract PropertyChangedBeforeAfterEventHandler GetCallback(MemberInfo memberWithAttribute, out Type expectedCallbackParam)
Parameters
Type |
Name |
Description |
System.Reflection.MemberInfo |
memberWithAttribute |
|
System.Type |
expectedCallbackParam |
|
Returns
GetRootTypeAndMember(MemberInfo)
Give the member we're an attribute on, determine what root type and property we're subscribing to.
Declaration
public (Type, MemberInfo) GetRootTypeAndMember(MemberInfo memberWithAttribute)
Parameters
Type |
Name |
Description |
System.Reflection.MemberInfo |
memberWithAttribute |
|
Returns
Type |
Description |
System.ValueTuple<System.Type, System.Reflection.MemberInfo> |
|
GetWatchedPropType(MemberInfo)
Get the type of the property that we're watching.
Declaration
public Type GetWatchedPropType(MemberInfo rootMember)
Parameters
Type |
Name |
Description |
System.Reflection.MemberInfo |
rootMember |
|
Returns
Type |
Description |
System.Type |
|
GetWatchedSubMember(MemberInfo)
Declaration
public PropertyInfo GetWatchedSubMember(MemberInfo rootMember)
Parameters
Type |
Name |
Description |
System.Reflection.MemberInfo |
rootMember |
|
Returns
Type |
Description |
System.Reflection.PropertyInfo |
|
GetWatchedSubPropType(MemberInfo)
Declaration
public Type GetWatchedSubPropType(MemberInfo rootMember)
Parameters
Type |
Name |
Description |
System.Reflection.MemberInfo |
rootMember |
|
Returns
Type |
Description |
System.Type |
|
ObjectIsExpectedType(Object)
We check if the type of the object is what we are expecting using any specified conditions.
Declaration
public bool ObjectIsExpectedType(object obj)
Parameters
Type |
Name |
Description |
System.Object |
obj |
|
Returns
Type |
Description |
System.Boolean |
|
PassEventFirstParamToCallback(Type, Type)
This is used when watching an event with a param to see whether we want to pass the param of that event to the callback or pass type of the root class instead.
True -> assign param.
False -> assign type.
Declaration
public virtual bool PassEventFirstParamToCallback(Type firstParamType, Type rootType)
Parameters
Type |
Name |
Description |
System.Type |
firstParamType |
|
System.Type |
rootType |
|
Returns
Type |
Description |
System.Boolean |
|
Extension Methods