-
Notifications
You must be signed in to change notification settings - Fork 1
/
AFCEventManager.cs
56 lines (47 loc) · 1.32 KB
/
AFCEventManager.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
using System;
using System.Linq;
using System.Text;
using System.Collections;
using System.Collections.Generic;
namespace AFCoreEx
{
public class AFCEventManager : AFIEventManager
{
public AFCEventManager(AFIDENTID self)
{
mSelf = self;
mhtEvent = new Dictionary<int, AFIEvent>();
}
public override void RegisterCallback(int nEventID, AFIEvent.EventHandler handler, AFIDataList valueList)
{
if (!mhtEvent.ContainsKey(nEventID))
{
mhtEvent.Add(nEventID, new AFCEvent(mSelf, nEventID, valueList));
}
AFIEvent identEvent = (AFIEvent)mhtEvent[nEventID];
identEvent.RegisterCallback(handler);
}
public override void DoEvent(int nEventID, AFIDataList valueList)
{
if (mhtEvent.ContainsKey(nEventID))
{
AFIEvent identEvent = (AFIEvent)mhtEvent[nEventID];
identEvent.DoEvent(valueList);
}
}
public override void RemoveCallback(int nEventID, AFIEvent.EventHandler handler, AFIDataList valueList)
{
if (!mhtEvent.ContainsKey(nEventID))
{
return;
}
AFIEvent identEvent = (AFIEvent)mhtEvent[nEventID];
if (null != identEvent)
{
identEvent.RemoveCallback(handler);
}
}
AFIDENTID mSelf;
Dictionary<int, AFIEvent> mhtEvent;
}
}