Line | |
---|
1 | using System;
|
---|
2 |
|
---|
3 | namespace Netron.Diagramming.Core {
|
---|
4 | abstract class ActivityBase : IActivity {
|
---|
5 | #region Events
|
---|
6 | public event EventHandler OnActivityRun;
|
---|
7 | #endregion
|
---|
8 |
|
---|
9 | #region Fields
|
---|
10 | private bool mEnabled;
|
---|
11 | private TimeSpan mStepTime = new TimeSpan(0, 0, 80);
|
---|
12 | private DateTime mStartTime = DateTime.Now;
|
---|
13 | private string mName;
|
---|
14 | #endregion
|
---|
15 |
|
---|
16 | #region Properties
|
---|
17 | public string Name {
|
---|
18 | get { return mName; }
|
---|
19 | }
|
---|
20 | public bool Enabled {
|
---|
21 | get {
|
---|
22 | return mEnabled;
|
---|
23 | }
|
---|
24 | set {
|
---|
25 | mEnabled = value;
|
---|
26 | }
|
---|
27 | }
|
---|
28 |
|
---|
29 | public TimeSpan StepTime {
|
---|
30 | get {
|
---|
31 | return mStepTime;
|
---|
32 | }
|
---|
33 | set {
|
---|
34 | mStepTime = value;
|
---|
35 | }
|
---|
36 | }
|
---|
37 |
|
---|
38 | public DateTime StartTime {
|
---|
39 | get {
|
---|
40 | return mStartTime;
|
---|
41 | }
|
---|
42 | set {
|
---|
43 | mStartTime = value;
|
---|
44 | }
|
---|
45 | }
|
---|
46 |
|
---|
47 | public TimeSpan Duration {
|
---|
48 | get {
|
---|
49 |
|
---|
50 | return mStepTime;
|
---|
51 | }
|
---|
52 | }
|
---|
53 | #endregion
|
---|
54 | protected ActivityBase(string name) { mName = name; }
|
---|
55 |
|
---|
56 | public abstract void Run();
|
---|
57 |
|
---|
58 | public abstract void Run(int time);
|
---|
59 |
|
---|
60 | public void RunAfter(IActivity firstActivity) {
|
---|
61 | throw new NotImplementedException("The method or operation is not implemented.");
|
---|
62 | }
|
---|
63 |
|
---|
64 | public abstract void Stop();
|
---|
65 |
|
---|
66 | protected void RaiseOnActivityRun() {
|
---|
67 | if (OnActivityRun != null)
|
---|
68 | OnActivityRun(this, EventArgs.Empty);
|
---|
69 | }
|
---|
70 | }
|
---|
71 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.