SharpLibEar/Action.cs
author StephaneLenclud
Sat, 23 Jul 2016 19:22:56 +0200
changeset 211 96f8b4dc4300
parent 210 83dd86e73448
child 212 1a0791daa243
permissions -rw-r--r--
Adding Events tab.
StephaneLenclud@210
     1
//
StephaneLenclud@210
     2
StephaneLenclud@210
     3
StephaneLenclud@210
     4
using System;
StephaneLenclud@210
     5
using System.Runtime.Serialization;
StephaneLenclud@210
     6
using System.Threading;
StephaneLenclud@210
     7
StephaneLenclud@210
     8
namespace SharpLib.Ear
StephaneLenclud@210
     9
{
StephaneLenclud@210
    10
    [DataContract]
StephaneLenclud@210
    11
    public abstract class Action: IComparable
StephaneLenclud@210
    12
    {
StephaneLenclud@210
    13
        public abstract void Execute();
StephaneLenclud@210
    14
StephaneLenclud@211
    15
        public string Name {
StephaneLenclud@211
    16
            //Get the name of this object action attribute
StephaneLenclud@211
    17
            get { return Utils.Reflection.GetAttribute<AttributeAction>(GetType()).Name; }
StephaneLenclud@211
    18
            private set { }
StephaneLenclud@211
    19
        }
StephaneLenclud@211
    20
StephaneLenclud@210
    21
        public int CompareTo(object obj)
StephaneLenclud@210
    22
        {
StephaneLenclud@210
    23
            //Sort by action name
StephaneLenclud@210
    24
            return Utils.Reflection.GetAttribute<AttributeAction>(GetType()).Name.CompareTo(obj.GetType());            
StephaneLenclud@210
    25
        }
StephaneLenclud@210
    26
    }
StephaneLenclud@210
    27
StephaneLenclud@210
    28
StephaneLenclud@210
    29
}