-
Notifications
You must be signed in to change notification settings - Fork 71
/
ArenaWindow.xaml.cs
396 lines (339 loc) · 10.1 KB
/
ArenaWindow.xaml.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
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
#region
using System;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Linq;
using System.Windows;
using System.Windows.Forms;
using Hearthstone_Deck_Tracker;
using Point = System.Drawing.Point;
using Hearthstone_Deck_Tracker.Hearthstone.Entities;
using Hearthstone_Deck_Tracker.Hearthstone;
using MahApps.Metro.Controls.Dialogs;
using System.Windows.Navigation;
using System.Diagnostics;
using MahApps.Metro;
#endregion
namespace ArenaHelper
{
public partial class ArenaWindow
{
private Card _card0;
private Card _card1;
private Card _card2;
public delegate void OnEvent();
public OnEvent onbuttonnewarenaclick = null;
public OnEvent onbuttonsaveclick = null;
public OnEvent onwindowlocation = null;
public OnEvent onconfigurehero = null;
public delegate void OnOverrideClick(int index);
public OnOverrideClick onheroclick = null;
public OnOverrideClick oncardclick = null;
public OnOverrideClick oncheroclick = null;
public delegate void OnCheckbox(bool check);
public OnCheckbox oncheckboxoverlay = null;
public OnCheckbox oncheckboxmanual = null;
public OnCheckbox oncheckboxautosave = null;
public OnEvent onupdatedownloadclick = null;
public bool initconfig = false;
public ArenaWindow()
{
InitializeComponent();
DataContext = this;
// Add handlers
CHero0.heromouseup += CHero0MouseUp;
CHero1.heromouseup += CHero1MouseUp;
CHero2.heromouseup += CHero2MouseUp;
CHero3.heromouseup += CHero3MouseUp;
CHero4.heromouseup += CHero4MouseUp;
CHero5.heromouseup += CHero5MouseUp;
CHero6.heromouseup += CHero6MouseUp;
CHero7.heromouseup += CHero7MouseUp;
CHero8.heromouseup += CHero8MouseUp;
CHero9.heromouseup += CHero9MouseUp;
CHero10.heromouseup += CHero10MouseUp;
}
public Card Card0
{
get { return _card0; }
set
{
_card0 = value;
}
}
public Card Card1
{
get { return _card1; }
set
{
_card1 = value;
}
}
public Card Card2
{
get { return _card2; }
set
{
_card2 = value;
}
}
public string StringGitHub
{
get { return "https://github.com/rembound/Arena-Helper"; }
}
private string stringversion;
public string StringVersion
{
get { return this.stringversion; }
set { this.stringversion = value; }
}
public void Update()
{
DataContext = null;
DataContext = this;
}
private void MetroWindow_LocationChanged(object sender, EventArgs e)
{
if (onwindowlocation != null)
{
onwindowlocation();
}
}
public Thickness TitleBarMargin
{
get { return new Thickness(0, TitlebarHeight, 0, 0); }
}
private void ButtonOptions_Click(object sender, RoutedEventArgs e)
{
FlyoutOptions.IsOpen = true;
}
private void ButtonAbout_Click(object sender, RoutedEventArgs e)
{
FlyoutAbout.IsOpen = true;
}
private void Hyperlink_RequestNavigate(object sender, RequestNavigateEventArgs e)
{
Process.Start(e.Uri.AbsoluteUri);
}
// About
private void AboutVisitGitHub_Click(object sender, RoutedEventArgs e)
{
Process.Start(StringGitHub);
}
private void AboutButtonClose_Click(object sender, RoutedEventArgs e)
{
FlyoutAbout.IsOpen = false;
}
// Update
private void UpdateDownload_Click(object sender, RoutedEventArgs e)
{
if (onupdatedownloadclick != null)
{
onupdatedownloadclick();
}
}
private void UpdateWebsite_Click(object sender, RoutedEventArgs e)
{
Process.Start(StringGitHub);
}
private void UpdateClose_Click(object sender, RoutedEventArgs e)
{
FlyoutUpdate.IsOpen = false;
}
// Data update
private void DataUpdateClose_Click(object sender, RoutedEventArgs e)
{
FlyoutDataUpdate.IsOpen = false;
}
private void ButtonNewArena_Click(object sender, RoutedEventArgs e)
{
if (onbuttonnewarenaclick != null)
{
onbuttonnewarenaclick();
}
}
private void ButtonSave_Click(object sender, RoutedEventArgs e)
{
if (onbuttonsaveclick != null)
{
onbuttonsaveclick();
}
}
private void HeroBorder0_MouseUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
// Override mouse detection
if (onheroclick != null)
{
onheroclick(0);
}
}
private void HeroBorder1_MouseUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
// Override mouse detection
if (onheroclick != null)
{
onheroclick(1);
}
}
private void HeroBorder2_MouseUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
// Override mouse detection
if (onheroclick != null)
{
onheroclick(2);
}
}
private void CardControl0_MouseUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
// Override mouse detection
if (oncardclick != null)
{
oncardclick(0);
}
}
private void CardControl1_MouseUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
// Override mouse detection
if (oncardclick != null)
{
oncardclick(1);
}
}
private void CardControl2_MouseUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
// Override mouse detection
if (oncardclick != null)
{
oncardclick(2);
}
}
private void CHero0MouseUp(object sender, RoutedEventArgs e)
{
if (oncheroclick != null)
{
oncheroclick(0);
}
}
private void CHero1MouseUp(object sender, RoutedEventArgs e)
{
if (oncheroclick != null)
{
oncheroclick(1);
}
}
private void CHero2MouseUp(object sender, RoutedEventArgs e)
{
if (oncheroclick != null)
{
oncheroclick(2);
}
}
private void CHero3MouseUp(object sender, RoutedEventArgs e)
{
if (oncheroclick != null)
{
oncheroclick(3);
}
}
private void CHero4MouseUp(object sender, RoutedEventArgs e)
{
if (oncheroclick != null)
{
oncheroclick(4);
}
}
private void CHero5MouseUp(object sender, RoutedEventArgs e)
{
if (oncheroclick != null)
{
oncheroclick(5);
}
}
private void CHero6MouseUp(object sender, RoutedEventArgs e)
{
if (oncheroclick != null)
{
oncheroclick(6);
}
}
private void CHero7MouseUp(object sender, RoutedEventArgs e)
{
if (oncheroclick != null)
{
oncheroclick(7);
}
}
private void CHero8MouseUp(object sender, RoutedEventArgs e)
{
if (oncheroclick != null)
{
oncheroclick(8);
}
}
private void CHero9MouseUp(object sender, RoutedEventArgs e)
{
if (oncheroclick != null)
{
oncheroclick(9);
}
}
private void CHero10MouseUp(object sender, RoutedEventArgs e)
{
if (oncheroclick != null)
{
oncheroclick(10);
}
}
private void CheckBoxOverlay_Checked(object sender, RoutedEventArgs e)
{
if (oncheckboxoverlay != null)
{
oncheckboxoverlay(true);
}
}
private void CheckBoxOverlay_Unchecked(object sender, RoutedEventArgs e)
{
if (oncheckboxoverlay != null)
{
oncheckboxoverlay(false);
}
}
private void CheckBoxManual_Checked(object sender, RoutedEventArgs e)
{
if (oncheckboxmanual != null)
{
oncheckboxmanual(true);
}
}
private void CheckBoxManual_Unchecked(object sender, RoutedEventArgs e)
{
if (oncheckboxmanual != null)
{
oncheckboxmanual(false);
}
}
private void CheckBoxAutoSave_Checked(object sender, RoutedEventArgs e)
{
if (oncheckboxautosave != null)
{
oncheckboxautosave(true);
}
}
private void CheckBoxAutoSave_Unchecked(object sender, RoutedEventArgs e)
{
if (oncheckboxautosave != null)
{
oncheckboxautosave(false);
}
}
private void ConfigureHero_MouseUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
// Override hero detection
if (onconfigurehero != null)
{
onconfigurehero();
}
}
}
}