author | StephaneLenclud |
Thu, 25 Aug 2016 13:12:54 +0200 | |
changeset 254 | 181323a59047 |
parent 239 | dd7770b97916 |
child 258 | e237c2e33545 |
permissions | -rw-r--r-- |
1 //
4 using System;
5 using System.Collections.Generic;
6 using System.Diagnostics;
7 using System.Runtime.Serialization;
8 using System.Threading;
10 namespace SharpLib.Ear
11 {
12 [DataContract]
13 public abstract class Action: Object
14 {
15 protected abstract void DoExecute();
17 /// <summary>
18 /// Allows testing from generic edit dialog.
19 /// </summary>
20 public void Test()
21 {
22 Trace.WriteLine("Action test");
23 Execute();
24 }
26 public void Execute()
27 {
28 Trace.WriteLine("Action executing: " + Brief());
29 if (!IsValid())
30 {
31 Trace.WriteLine($"WARNING: action invalid, aborting execution.");
32 return;
33 }
35 DoExecute();
36 }
38 }
41 }