SharpLibEar/Action.cs
author StephaneLenclud
Sun, 24 Jul 2016 14:22:56 +0200
changeset 213 77092f415c7c
parent 211 96f8b4dc4300
child 220 e5910d7b6a81
permissions -rw-r--r--
Reflection functions now working on all loaded assemblies.
     1 //
     2 
     3 
     4 using System;
     5 using System.Collections.Generic;
     6 using System.Runtime.Serialization;
     7 using System.Threading;
     8 
     9 namespace SharpLib.Ear
    10 {
    11     [DataContract]
    12     [KnownType("DerivedTypes")]
    13     public abstract class Action: IComparable
    14     {
    15         public abstract void Execute();
    16 
    17         public string Name {
    18             //Get the name of this object action attribute
    19             get { return Utils.Reflection.GetAttribute<AttributeAction>(GetType()).Name; }
    20             private set { }
    21         }
    22 
    23         public int CompareTo(object obj)
    24         {
    25             //Sort by action name
    26             return Utils.Reflection.GetAttribute<AttributeAction>(GetType()).Name.CompareTo(obj.GetType());            
    27         }
    28 
    29         private static IEnumerable<Type> DerivedTypes()
    30         {
    31             return SharpLib.Utils.Reflection.GetDerivedTypes<Action>();
    32         }
    33 
    34     }
    35 
    36 
    37 }