EventGroup.cs
1.3 KB
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
using Model;
using System;
using System.Collections.Generic;
using System.Linq;
namespace ExtensionGroup
{
public class EventGroup
{
public event IExtension.PrintDelegate Printing;
private readonly Dictionary<string, IExtension> extEvent;
private readonly Alcoelectro alcoelectro = new();
private readonly Inventec inventec = new();
private readonly PanaCIM panaCIM = new();
private readonly Item_NanRui nanRui = new();
private readonly KaiFa kaiFa = new();
public EventGroup()
{
extEvent = new()
{
{ "Bwit", alcoelectro },
{ "Inventec", inventec },
{ "PanaCIM", panaCIM },
{ "NanRui", nanRui },
{ "KaiFa", kaiFa }
};
for (int i = 0; i < extEvent.Count; i++)
extEvent.ElementAt(i).Value.Printing += Group_Printing;
}
public IExtension GetEventGroup(string name)
{
if (extEvent.ContainsKey(name))
return extEvent[name];
else
return null;
}
private void Group_Printing(Dictionary<string, string> content)
{
Printing?.Invoke(content);
}
}
}