-
Notifications
You must be signed in to change notification settings - Fork 6
/
frmMain.cs
239 lines (201 loc) · 7.6 KB
/
frmMain.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using MyPhonePlugins;
using Busylight;
using Microsoft.Win32;
using MyCRMPlugin.Properties;
using System.Diagnostics;
using System.Management;
using MyCRMPlugins;
namespace BusylightTester
{
public partial class frmMain : Form
{
// private static frmMain instance = null;
internal Busylight.SDK busylight = null;
public frmMain()
{
InitializeComponent();
this.WindowState = FormWindowState.Minimized;
busylight = new Busylight.SDK();
cmbSensivity.Items.Clear();
cmbSensivity.Items.Add(new KeyValuePair<string, byte>("1", 0));
cmbSensivity.Items.Add(new KeyValuePair<string, byte>("2", 2));
cmbSensivity.Items.Add(new KeyValuePair<string, byte>("3", 4));
cmbSensivity.Items.Add(new KeyValuePair<string, byte>("4", 8));
cmbSensivity.Items.Add(new KeyValuePair<string, byte>("5", 16));
cmbSensivity.SelectedItem = cmbSensivity.Items[2];
cmbTimeout.Items.Clear();
for (byte i = 3; i <= 20; i++)
{
cmbTimeout.Items.Add(new KeyValuePair<string, byte>(i.ToString(), i));
}
cmbTimeout.SelectedItem = cmbTimeout.Items[1];
cmbTriggertime.Items.Clear();
cmbTriggertime.Items.Add(new KeyValuePair<string, byte>("1", 85));
cmbTriggertime.Items.Add(new KeyValuePair<string, byte>("2", 126));
cmbTriggertime.Items.Add(new KeyValuePair<string, byte>("3", 167));
cmbTriggertime.Items.Add(new KeyValuePair<string, byte>("4", 208));
cmbTriggertime.Items.Add(new KeyValuePair<string, byte>("5", 250));
cmbTriggertime.SelectedItem = cmbTriggertime.Items[0];
// this.Text = "Testje" + busylight.Version;
}
private void frmMain_Shown(object sender, EventArgs e)
{
busylight.BusyLightChanged += busylight_BusyLightChanged;
busylight.KuandoBoxActivityDetected += busylight_KuandoBoxActivityDetected;
FillListBox();
}
void busylight_KuandoBoxActivityDetected(bool obj)
{
if (obj)
{
pbColor.BackColor = Color.Green;
}
else
{
pbColor.BackColor = Color.LimeGreen;
}
}
void busylight_BusyLightChanged(object sender, EventArgs e)
{
FillListBox();
}
void FillListBox()
{
if (this.InvokeRequired)
{
this.Invoke((MethodInvoker)delegate
{
FillListBox();
});
return;
}
else
{
bool inputsupported = false;
listBox1.Items.Clear();
var list = busylight.GetAttachedBusylightDeviceList();
foreach (var s in list)
{
listBox1.Items.Add(s.ProductID + " " + s.USBID + " " + s.FirmwareRelease + " " + "test");
if (s.IsInputEventSupported)
{
inputsupported = true;
}
}
pnlKuandoBox.Visible = inputsupported;
}
}
private void btnGreen_Click(object sender, EventArgs e)
{
busylight.Light(Busylight.BusylightColor.Green);
}
internal void btnRedWithSound_Click(object sender, EventArgs e)
{
Busylight.BusylightVolume vol = (Busylight.BusylightVolume)tbVolume.Value;
busylight.Alert(Busylight.BusylightColor.Red, Busylight.BusylightSoundClip.KuandoTrain, vol);
}
private void frmMain_FormClosing(object sender, FormClosingEventArgs e)
{
busylight.Terminate();
}
private void btnPulse_Click(object sender, EventArgs e)
{
/*
Busylight.PulseSequence ps = new Busylight.PulseSequence
{
Color = Busylight.BusylightColor.Yellow,
Step1 = 3,
Step2 = 21,
Step3 = 36,
Step4 = 50,
Step5 = 36,
Step6 = 21,
Step7 = 10,
//Step8 = 21
};*/
Busylight.PulseSequence ps = Busylight.PulseSequence.Standard;
ps.Color = Busylight.BusylightColor.Green;
busylight.Pulse(ps);
//busylight.Pulse(Busylight.BusylightColor.Green);
}
private void cmbSensivity_SelectedIndexChanged(object sender, EventArgs e)
{
if (busylight != null)
{
busylight.DPI_Sensivity = ((KeyValuePair<string, byte>)cmbSensivity.SelectedItem).Value;
}
}
private void cmbTimeout_SelectedIndexChanged(object sender, EventArgs e)
{
if (busylight != null)
{
busylight.DPI_Timeout = ((KeyValuePair<string, byte>)cmbTimeout.SelectedItem).Value;
}
}
private void cmbTriggertime_SelectedIndexChanged(object sender, EventArgs e)
{
if (busylight != null)
{
busylight.DPI_Triggertime = ((KeyValuePair<string, byte>)cmbTriggertime.SelectedItem).Value;
}
}
private void btnJingle_Click(object sender, EventArgs e)
{
if (busylight != null)
{
Busylight.BusylightVolume vol = (Busylight.BusylightVolume)tbVolume.Value;
busylight.Jingle(Busylight.BusylightColor.Yellow, Busylight.BusylightJingleClip.IM1, vol);
}
}
private void btnCustom_Click(object sender, EventArgs e)
{
frmCustom frcu = new frmCustom(this);
frcu.Show();
}
private void btnJingle2_Click(object sender, EventArgs e)
{
if (busylight != null)
{
Busylight.BusylightVolume vol = (Busylight.BusylightVolume)tbVolume.Value;
busylight.Jingle(Busylight.BusylightColor.Yellow, Busylight.BusylightJingleClip.IM2, vol);
}
}
private void btnGBFlash_Click(object sender, EventArgs e)
{
if (busylight != null)
{
busylight.ColorWithFlash(Busylight.BusylightColor.Green, Busylight.BusylightColor.Blue);
}
}
private void btnRBFlash_Click(object sender, EventArgs e)
{
if (busylight != null)
{
busylight.ColorWithFlash(Busylight.BusylightColor.Red, Busylight.BusylightColor.Blue);
}
}
private void btnYBFlash_Click(object sender, EventArgs e)
{
if (busylight != null)
{
busylight.Blink(Busylight.BusylightColor.Red, 5, 5); // 500ms on, 500ms of -> 1Hz)
}
}
private void frmMain_Load(object sender, EventArgs e)
{
}
private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
this.WindowState = FormWindowState.Minimized;
}
}
}