cec-config-gui: display the detected menu language
[deb_libcec.git] / src / cec-config-gui / actions / UpdateEvent.cs
CommitLineData
006b76b9
LOK
1using System;
2using System.Collections.Generic;
3using System.Text;
4using CecSharp;
5
6namespace CecConfigGui
7{
8 public enum UpdateEventType
9 {
10 ProcessCompleted,
11 StatusText,
12 ProgressBar,
13 TVVendorId,
14 BaseDevicePhysicalAddress,
15 BaseDevice,
16 HDMIPort,
17 PhysicalAddress,
18 HasAVRDevice,
19 AVRVendorId,
f976869e
LOK
20 Configuration,
21 MenuLanguage
006b76b9
LOK
22 }
23
24 public class UpdateEvent : EventArgs
25 {
26 public UpdateEvent(UpdateEventType type, bool value)
27 {
28 Type = type;
29 BoolValue = value;
30 }
31
32 public UpdateEvent(UpdateEventType type, int value)
33 {
34 Type = type;
35 IntValue = value;
36 }
37
38 public UpdateEvent(UpdateEventType type, string value)
39 {
40 Type = type;
41 StringValue = value;
42 }
43
44 public UpdateEvent(LibCECConfiguration config)
45 {
46 Type = UpdateEventType.Configuration;
47 ConfigValue = config;
48 }
49
50 public UpdateEventType Type;
51 public bool BoolValue = false;
52 public int IntValue = -1;
53 public string StringValue = String.Empty;
54 public LibCECConfiguration ConfigValue = null;
55 }
56
57 public abstract class UpdateProcess
58 {
59 public UpdateProcess()
60 {
61 }
62
63 public void SendEvent(UpdateEventType type, bool value)
64 {
65 EventHandler<UpdateEvent> temp = EventHandler;
66 if (temp != null)
67 temp(this, new UpdateEvent(type, value));
68 }
69
70 public void SendEvent(UpdateEventType type, int value)
71 {
72 EventHandler<UpdateEvent> temp = EventHandler;
73 if (temp != null)
74 temp(this, new UpdateEvent(type, value));
75 }
76
77 public void SendEvent(UpdateEventType type, string value)
78 {
79 EventHandler<UpdateEvent> temp = EventHandler;
80 if (temp != null)
81 temp(this, new UpdateEvent(type, value));
82 }
83
84 public void SendEvent(LibCECConfiguration config)
85 {
86 EventHandler<UpdateEvent> temp = EventHandler;
87 if (temp != null)
88 temp(this, new UpdateEvent(config));
89 }
90
91 public void Run()
92 {
93 Process();
94 SendEvent(UpdateEventType.ProcessCompleted, true);
95 }
96
97 public abstract void Process();
98 public event EventHandler<UpdateEvent> EventHandler;
99 }
100}