-
Notifications
You must be signed in to change notification settings - Fork 1
/
MainWindow.xaml.cs
222 lines (170 loc) · 6.01 KB
/
MainWindow.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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Diagnostics;
namespace Lennifier_2._0
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
// declare the sets. No more than 9.
string[] Common = new string[]
{
@"( ͡° ͜ʖ ͡°)",
@"ヽ༼ຈل͜ຈ༽ノ",
@"¯\__(ツ)__/¯",
@"(☞゚ヮ゚)☞",
@"ಠ__ಠ",
@"ʕ•ᴥ•ʔ",
@"(╯°□°)╯︵ ┻━┻",
@"(ง ͠° ͟ل͜ ͡°)ง",
@"ᕕ(ᐛ)ᕗ"
};
// declare the sets. No more than 9.
string[] Lenny = new string[]
{
@"( ͡° ͜ʖ ͡°)",
@"ᕦ( ͡° ͜ʖ ͡°)ᕤ",
@"ʕ ͡° ͜ʖ ͡°ʔ",
@"( ͡o ͜ʖ ͡o)",
@"(ง ͠° ͟ل͜ ͡°)ง",
@"( ͡~ ͜ʖ ͡°)",
@"[̲̅$̲̅(̲̅ ͡° ͜ʖ ͡°̲̅)̲̅$̲̅]",
@"(ง ͡° ͜ʖ ͡°)=/̵͇̿̿/'̿'̿̿̿ ̿ ̿̿",
@"/\/( ͡°͡° ͜ʖ ͡°͡°)\/\"
};
IDictionary<string, string[]> faceSets = new Dictionary<string, string[]>();
string currentSet = null;
public MainWindow()
{
InitializeComponent();
CenterWindowOnScreen();
Debug.WriteLine("Program loaded.");
// add new face sets to list
faceSets.Add("Lenny", Lenny);
faceSets.Add("Common", Common);
// load the requested face set.
loadFaces("Common");
//frame.Title += currentSet; // for another time
}
private void loadFaces(String set)
{
if (faceSets.ContainsKey(set))
{
currentSet = set;
// load up the faces
b1.Content = b1.ToolTip = faceSets[set][0];
b2.Content = b2.ToolTip = faceSets[set][1];
b3.Content = b3.ToolTip = faceSets[set][2];
b4.Content = b4.ToolTip = faceSets[set][3];
b5.Content = b5.ToolTip = faceSets[set][4];
b6.Content = b6.ToolTip = faceSets[set][5];
b7.Content = b7.ToolTip = faceSets[set][6];
b8.Content = b8.ToolTip = faceSets[set][7];
b9.Content = b9.ToolTip = faceSets[set][8];
}
else
{
Debug.WriteLine("Requested face set \"" + set + "\" could not be loaded.");
}
}
private void closeProgram(object sender, EventArgs e)
{
Debug.WriteLine("Focus lost, exiting...");
Application.Current.Shutdown();
}
// one of the buttons was pressed
private void buttonPress(object sender, RoutedEventArgs e)
{
Clipboard.SetText((sender as Button).Content.ToString());
closeProgram(null, null);
}
private void numpadPress(object sender, KeyEventArgs e)
{
// the numpad is upside down and the array starts at 0. It's annoying and confusing.
// I also got a bit sloppy here.
if (e.Key == Key.NumPad7)
{
Clipboard.SetText(faceSets[currentSet][0]);
closeProgram(null, null);
}
else if (e.Key == Key.NumPad8)
{
Clipboard.SetText(faceSets[currentSet][1]);
closeProgram(null, null);
}
else if (e.Key == Key.NumPad9)
{
Clipboard.SetText(faceSets[currentSet][2]);
closeProgram(null, null);
}
else if (e.Key == Key.NumPad4)
{
Clipboard.SetText(faceSets[currentSet][3]);
closeProgram(null, null);
}
else if (e.Key == Key.NumPad5)
{
Clipboard.SetText(faceSets[currentSet][4]);
closeProgram(null, null);
}
else if (e.Key == Key.NumPad6)
{
Clipboard.SetText(faceSets[currentSet][5]);
closeProgram(null, null);
}
else if (e.Key == Key.NumPad1)
{
Clipboard.SetText(faceSets[currentSet][6]);
closeProgram(null, null);
}
else if (e.Key == Key.NumPad2)
{
Clipboard.SetText(faceSets[currentSet][7]);
closeProgram(null, null);
}
else if (e.Key == Key.NumPad3)
{
Clipboard.SetText(faceSets[currentSet][8]);
closeProgram(null, null);
}
// for swapping face sets
else if (e.Key == Key.D1)
{
loadFaces("Common");
}
else if (e.Key == Key.D2)
{
loadFaces("Lenny");
}
else if (e.Key == Key.Escape)
{
closeProgram(null, null);
}
}
// code to get the window dead center. Might dissable this,
//but if you have multiple monitors, it will open the window on the active monitor
private void CenterWindowOnScreen()
{
double screenWidth = System.Windows.SystemParameters.PrimaryScreenWidth;
double screenHeight = System.Windows.SystemParameters.PrimaryScreenHeight;
double windowWidth = this.Width;
double windowHeight = this.Height;
this.Left = (screenWidth / 2) - (windowWidth / 2);
this.Top = (screenHeight / 2) - (windowHeight / 2);
}
}
}