forked from rembound/Arena-Helper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathArenaWindow.xaml.cs
210 lines (181 loc) · 5.23 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
#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;
#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 onaboutclick = null;
public delegate void OnOverrideClick(int index);
public OnOverrideClick onheroclick = null;
public OnOverrideClick oncardclick = null;
public delegate void OnCheckbox(bool check);
public OnCheckbox oncheckboxoverlay = null;
public OnCheckbox oncheckboxmanual = null;
public bool initconfig = false;
public ArenaWindow()
{
InitializeComponent();
DataContext = this;
}
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 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)
{
if (onaboutclick != null)
{
onaboutclick();
}
}
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 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);
}
}
}
}