1
//
2
3
4
using System;
5
using System.Collections.Generic;
6
using System.Diagnostics;
7
using System.Runtime.Serialization;
8
using System.Threading;
9
10
namespace SharpLib.Ear
11
{
12
[DataContract]
13
public abstract class Action: Object
14
15
protected abstract void DoExecute();
16
17
/// <summary>
18
/// Allows testing from generic edit dialog.
19
/// </summary>
20
public void Test()
21
22
Trace.WriteLine("Action test");
23
Execute();
24
}
25
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
34
35
DoExecute();
36
37
38
39
40
41