-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOptionsWindow.xaml.cs
More file actions
861 lines (772 loc) · 33.9 KB
/
OptionsWindow.xaml.cs
File metadata and controls
861 lines (772 loc) · 33.9 KB
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
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
using System;
using System.Windows;
using System.Windows.Media;
using System.IO;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
namespace Goal_Tracker
{
public partial class OptionsWindow : Window
{
public OptionsWindow()
{
InitializeComponent();
this.MaxWidth = SystemParameters.MaximizedPrimaryScreenWidth;
this.MaxHeight = SystemParameters.MaximizedPrimaryScreenHeight;
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
/* --- Colors & Style --- */
BgColorTextBox.Text = LoadFromIni("Color", "BgColor");
if (LoadFromIni("Color", "BorderType") == "B")
{
BorderStyleToggleButton.Content = "Type B";
}
VeryEasyBorderTextBox.Text = LoadOrDefault("Color", "VeryEasyBorder", "#80d0d0");
EasyBorderTextBox.Text = LoadOrDefault("Color", "EasyBorder", "#40d080");
NormalBorderTextBox.Text = LoadOrDefault("Color", "NormalBorder", "#40d040");
HardBorderTextBox.Text = LoadOrDefault("Color", "HardBorder", "#f8d000");
ToughBorderTextBox.Text = LoadOrDefault("Color", "ToughBorder", "#f02800");
InsaneBorderTextBox.Text = LoadOrDefault("Color", "InsaneBorder", "#e048f0");
ExtremeBorderTextBox.Text = LoadOrDefault("Color", "ExtremeBorder", "#8000a0");
ExtremeIIBorderTextBox.Text = LoadOrDefault("Color", "ExtremeIIBorder", "#780050");
ExtremeIIIBorderTextBox.Text = LoadOrDefault("Color", "ExtremeIIIBorder", "#70001b");
ImpossibleBorderTextBox.Text = LoadOrDefault("Color", "ImpossibleBorder", "#d35d6e");
VeryEasyName.Text = LoadOrDefault("Color", "VeryEasyName", "Very Easy");
EasyName.Text = LoadOrDefault("Color", "EasyName", "Easy");
NormalName.Text = LoadOrDefault("Color", "NormalName", "Normal");
HardName.Text = LoadOrDefault("Color", "HardName", "Hard");
ToughName.Text = LoadOrDefault("Color", "ToughName", "Tough");
InsaneName.Text = LoadOrDefault("Color", "InsaneName", "Insane");
ExtremeName.Text = LoadOrDefault("Color", "ExtremeName", "Extreme");
ExtremeIIName.Text = LoadOrDefault("Color", "ExtremeIIName", "Extreme II");
ExtremeIIIName.Text = LoadOrDefault("Color", "ExtremeIIIName", "Extreme III");
ImpossibleName.Text = LoadOrDefault("Color", "ImpossibleName", "Impossible");
// Very Easy
VeryEasyFillTextBox.Text = LoadOrDefault("Color", "VeryEasyFill", "#a0f8f8");
if (LoadFromIni("Color", "VeryEasyWText") == "True")
{
VeryEasyTColorButton.Background = Brushes.Black;
VeryEasyTColorButton.Foreground = Brushes.White;
}
// Easy
EasyFillTextBox.Text = LoadOrDefault("Color", "EasyFill", "#50f8a0");
if (LoadFromIni("Color", "EasyWText") == "True")
{
EasyTColorButton.Background = Brushes.Black;
EasyTColorButton.Foreground = Brushes.White;
}
// Normal
NormalFillTextBox.Text = LoadOrDefault("Color", "NormalFill", "#50f862");
if (LoadFromIni("Color", "NormalWText") == "True")
{
NormalTColorButton.Background = Brushes.Black;
NormalTColorButton.Foreground = Brushes.White;
}
// Hard
HardFillTextBox.Text = LoadOrDefault("Color", "HardFill", "#fff840");
if (LoadFromIni("Color", "HardWText") == "True")
{
HardTColorButton.Background = Brushes.Black;
HardTColorButton.Foreground = Brushes.White;
}
// Tough
ToughFillTextBox.Text = LoadOrDefault("Color", "ToughFill", "#ff5046");
if (LoadFromIni("Color", "ToughWText") == "True")
{
ToughTColorButton.Background = Brushes.Black;
ToughTColorButton.Foreground = Brushes.White;
}
// Insane
InsaneFillTextBox.Text = LoadOrDefault("Color", "InsaneFill", "#ff5aff");
if (LoadFromIni("Color", "InsaneWText") == "True")
{
InsaneTColorButton.Background = Brushes.Black;
InsaneTColorButton.Foreground = Brushes.White;
}
// Extreme
ExtremeFillTextBox.Text = LoadOrDefault("Color", "ExtremeFill", "#a000c8");
if (LoadFromIni("Color", "ExtremeWText") == "False")
{
ExtremeTColorButton.Background = Brushes.White;
ExtremeTColorButton.Foreground = Brushes.Black;
}
// Extreme II
ExtremeIIFillTextBox.Text = LoadOrDefault("Color", "ExtremeIIFill", "#960062");
if (LoadFromIni("Color", "ExtremeIIWText") == "False")
{
ExtremeIITColorButton.Background = Brushes.White;
ExtremeIITColorButton.Foreground = Brushes.Black;
}
// Extreme III
ExtremeIIIFillTextBox.Text = LoadOrDefault("Color", "ExtremeIIIFill", "#8c0023");
if (LoadFromIni("Color", "ExtremeIIIWText") == "False")
{
ExtremeIIITColorButton.Background = Brushes.White;
ExtremeIIITColorButton.Foreground = Brushes.Black;
}
// Impossible
ImpossibleFillTextBox.Text = LoadOrDefault("Color", "ImpossibleFill", "#000000");
if (LoadFromIni("Color", "ImpossibleWText") == "False")
{
ImpossibleTColorButton.Background = Brushes.White;
ImpossibleTColorButton.Foreground = Brushes.Black;
}
/* --- General --- */
if (LoadFromIni("General", "AutoSort") == "True")
{
AutoSortButton.IsChecked = true;
}
if (LoadFromIni("General", "MoreTier") == "True")
{
MoreTierButton.IsChecked = true;
}
}
private string LoadOrDefault(string section, string key, string defaultValue)
{
string value = LoadFromIni(section, key);
return string.IsNullOrWhiteSpace(value) ? defaultValue : value;
}
public string LoadFromIni(string section, string key)
{
string iniFilePath = "gtoptions.ini"; // Path to your INI file
try
{
if (File.Exists(iniFilePath))
{
var lines = File.ReadAllLines(iniFilePath);
bool sectionFound = false;
foreach (var line in lines)
{
if (line.StartsWith($"[{section}]"))
{
sectionFound = true;
}
if (sectionFound && line.StartsWith(key))
{
var keyValue = line.Split('=');
if (keyValue.Length == 2)
{
return keyValue[1].Trim(); // Return the value
}
}
}
}
}
catch (Exception ex)
{
Console.WriteLine($"Error reading from INI file: {ex.Message}");
}
return string.Empty; // Return empty string if the key is not found
}
public static void SaveToIni(string section, string key, string value)
{
string iniFilePath = "gtoptions.ini"; // Path to your INI file
try
{
var lines = File.Exists(iniFilePath) ? File.ReadAllLines(iniFilePath).ToList() : new List<string>();
bool sectionFound = false;
bool keyUpdated = false;
int sectionIndex = -1;
int insertIndex = -1; // Default to appending at the end of the section
for (int i = 0; i < lines.Count; i++)
{
string line = lines[i].Trim();
// Check if it's a section
if (line.StartsWith("[") && line.EndsWith("]"))
{
if (sectionFound) // If we were in the right section and found a new one, stop searching
break;
if (line == $"[{section}]")
{
sectionFound = true;
sectionIndex = i;
}
}
// If in the correct section, look for the key
if (sectionFound && line.StartsWith($"{key}="))
{
lines[i] = $"{key}={value}"; // Overwrite existing key
keyUpdated = true;
break;
}
// If in the correct section and we find a blank line, mark where we can insert
if (sectionFound && string.IsNullOrWhiteSpace(line) && insertIndex == -1)
{
insertIndex = i;
}
}
if (sectionFound && !keyUpdated)
{
// Insert key-value pair inside the section, either at a blank line or at the end of the section
if (insertIndex != -1)
lines.Insert(insertIndex, $"{key}={value}");
else
lines.Insert(sectionIndex + 1, $"{key}={value}"); // No blank lines, insert right after section header
}
else if (!sectionFound)
{
// Append new section and key-value pair at the end of the file
lines.Add($"[{section}]");
lines.Add($"{key}={value}");
}
File.WriteAllLines(iniFilePath, lines);
}
catch (Exception ex)
{
Console.WriteLine($"Error saving to INI file: {ex.Message}");
}
}
public void DeleteKeyFromIni(string section, string key)
{
string iniFilePath = "gtoptions.ini";
if (!File.Exists(iniFilePath))
{
throw new FileNotFoundException($"The INI file '{iniFilePath}' does not exist.");
}
var lines = File.ReadAllLines(iniFilePath).ToList();
bool inTargetSection = false;
bool keyDeleted = false;
for (int i = 0; i < lines.Count; i++)
{
string line = lines[i].Trim();
// Check if this line is a section
if (line.StartsWith('[') && line.EndsWith(']'))
{
inTargetSection = string.Equals(line, $"[{section}]", StringComparison.OrdinalIgnoreCase);
}
else if (inTargetSection && line.StartsWith($"{key}=", StringComparison.OrdinalIgnoreCase))
{
// Remove the key if it's in the target section
lines.RemoveAt(i);
keyDeleted = true;
break;
}
}
if (keyDeleted)
{
// Write back to the file
File.WriteAllLines(iniFilePath, lines);
}
}
// Event handler for TextBox text change (to preview color)
private void BgColorTextBox_TextChanged(object sender, System.Windows.Controls.TextChangedEventArgs e)
{
// Get the color value from the TextBox and ensure it starts with '#'
string hexColor = BgColorTextBox.Text.Trim();
// If the color doesn't start with '#', add it
if (!hexColor.StartsWith('#'))
{
hexColor = "#" + hexColor;
}
// Validate if the input is a valid hex color string
if (IsValidHexColor(hexColor))
{
try
{
// Convert the hex color string to a Brush and update the color preview
var color = (Color)ColorConverter.ConvertFromString(hexColor);
BgColorPreview.Background = new SolidColorBrush(color);
SaveToIni("Color", "BgColor", hexColor);
}
catch (FormatException)
{
// Handle invalid color conversion (if necessary)
BgColorPreview.Background = Brushes.Gray; // Show gray if conversion fails
}
}
else
{
// If it's not a valid hex color, show a default gray preview
BgColorPreview.Background = Brushes.Gray;
}
}
// Validation
private string HandleColor(String colorinput, String key)
{
if (!colorinput.StartsWith('#'))
{
colorinput = "#" + colorinput;
}
if (IsValidHexColor(colorinput))
{
SaveToIni("Color", key, colorinput);
return colorinput;
}
else
{
return String.Empty;
}
}
// Utility function to check if the hex color is valid
private bool IsValidHexColor(string hex)
{
return System.Text.RegularExpressions.Regex.IsMatch(hex, "^#([0-9A-Fa-f]{6}|[0-9A-Fa-f]{8})$");
}
private void BorderStyleToggleButton_Click(object sender, RoutedEventArgs e)
{
if (sender is Button toggleButton)
{
if (BorderStyleToggleButton.Content.ToString() == "Type A")
{
BorderStyleToggleButton.Content = "Type B";
SaveToIni("Color", "BorderType", "B");
}
else
{
BorderStyleToggleButton.Content = "Type A";
SaveToIni("Color", "BorderType", "A");
}
}
}
// Very Easy Border Color TextChanged handler
private void VeryEasyBorderTextBox_TextChanged(object sender, System.Windows.Controls.TextChangedEventArgs e)
{
// Validate and set the border color for the preview
String color = HandleColor(VeryEasyBorderTextBox.Text, "VeryEasyBorder");
if (color != String.Empty)
{
VeryEasyBorderPreview.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString(color));
}
}
// Easy Border Color TextChanged handler
private void EasyBorderTextBox_TextChanged(object sender, System.Windows.Controls.TextChangedEventArgs e)
{
// Validate and set the border color for the preview
String color = HandleColor(EasyBorderTextBox.Text, "EasyBorder");
if (color != String.Empty)
{
EasyBorderPreview.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString(color));
}
}
// Normal Border Color TextChanged handler
private void NormalBorderTextBox_TextChanged(object sender, System.Windows.Controls.TextChangedEventArgs e)
{
// Validate and set the border color for the preview
String color = HandleColor(NormalBorderTextBox.Text, "NormalBorder");
if (color != String.Empty)
{
NormalBorderPreview.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString(color));
}
}
// Hard Border Color TextChanged handler
private void HardBorderTextBox_TextChanged(object sender, System.Windows.Controls.TextChangedEventArgs e)
{
// Validate and set the border color for the preview
String color = HandleColor(HardBorderTextBox.Text, "HardBorder");
if (color != String.Empty)
{
HardBorderPreview.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString(color));
}
}
// Tough Border Color TextChanged handler
private void ToughBorderTextBox_TextChanged(object sender, System.Windows.Controls.TextChangedEventArgs e)
{
// Validate and set the border color for the preview
String color = HandleColor(ToughBorderTextBox.Text, "ToughBorder");
if (color != String.Empty)
{
ToughBorderPreview.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString(color));
}
}
// Insane Border Color TextChanged handler
private void InsaneBorderTextBox_TextChanged(object sender, System.Windows.Controls.TextChangedEventArgs e)
{
// Validate and set the border color for the preview
String color = HandleColor(InsaneBorderTextBox.Text, "InsaneBorder");
if (color != String.Empty)
{
InsaneBorderPreview.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString(color));
}
}
// Extreme Border Color TextChanged handler
private void ExtremeBorderTextBox_TextChanged(object sender, System.Windows.Controls.TextChangedEventArgs e)
{
// Validate and set the border color for the preview
String color = HandleColor(ExtremeBorderTextBox.Text, "ExtremeBorder");
if (color != String.Empty)
{
ExtremeBorderPreview.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString(color));
}
}
// Extreme II Border Color TextChanged handler
private void ExtremeIIBorderTextBox_TextChanged(object sender, System.Windows.Controls.TextChangedEventArgs e)
{
// Validate and set the border color for the preview
String color = HandleColor(ExtremeIIBorderTextBox.Text, "ExtremeIIBorder");
if (color != String.Empty)
{
ExtremeIIBorderPreview.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString(color));
}
}
// Extreme III Border Color TextChanged handler
private void ExtremeIIIBorderTextBox_TextChanged(object sender, System.Windows.Controls.TextChangedEventArgs e)
{
// Validate and set the border color for the preview
String color = HandleColor(ExtremeIIIBorderTextBox.Text, "ExtremeIIIBorder");
if (color != String.Empty)
{
ExtremeIIIBorderPreview.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString(color));
}
}
// Impossible Border Color TextChanged handler
private void ImpossibleBorderTextBox_TextChanged(object sender, System.Windows.Controls.TextChangedEventArgs e)
{
// Validate and set the border color for the preview
String color = HandleColor(ImpossibleBorderTextBox.Text, "ImpossibleBorder");
if (color != String.Empty)
{
ImpossibleBorderPreview.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString(color));
}
}
// Very Easy
private void VeryEasyFillTextBox_TextChanged(object sender, System.Windows.Controls.TextChangedEventArgs e)
{
// Validate and set the border color for the preview
String color = HandleColor(VeryEasyFillTextBox.Text, "VeryEasyFill");
if (color != String.Empty)
{
VeryEasyFillPreview.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString(color));
}
}
// Easy
private void EasyFillTextBox_TextChanged(object sender, System.Windows.Controls.TextChangedEventArgs e)
{
String color = HandleColor(EasyFillTextBox.Text, "EasyFill");
if (color != String.Empty)
{
EasyFillPreview.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString(color));
}
}
// Normal
private void NormalFillTextBox_TextChanged(object sender, System.Windows.Controls.TextChangedEventArgs e)
{
String color = HandleColor(NormalFillTextBox.Text, "NormalFill");
if (color != String.Empty)
{
NormalFillPreview.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString(color));
}
}
// Hard
private void HardFillTextBox_TextChanged(object sender, System.Windows.Controls.TextChangedEventArgs e)
{
String color = HandleColor(HardFillTextBox.Text, "HardFill");
if (color != String.Empty)
{
HardFillPreview.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString(color));
}
}
// Tough
private void ToughFillTextBox_TextChanged(object sender, System.Windows.Controls.TextChangedEventArgs e)
{
String color = HandleColor(ToughFillTextBox.Text, "ToughFill");
if (color != String.Empty)
{
ToughFillPreview.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString(color));
}
}
// Insane
private void InsaneFillTextBox_TextChanged(object sender, System.Windows.Controls.TextChangedEventArgs e)
{
String color = HandleColor(InsaneFillTextBox.Text, "InsaneFill");
if (color != String.Empty)
{
InsaneFillPreview.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString(color));
}
}
// Extreme
private void ExtremeFillTextBox_TextChanged(object sender, System.Windows.Controls.TextChangedEventArgs e)
{
String color = HandleColor(ExtremeFillTextBox.Text, "ExtremeFill");
if (color != String.Empty)
{
ExtremeFillPreview.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString(color));
}
}
// Extreme II
private void ExtremeIIFillTextBox_TextChanged(object sender, System.Windows.Controls.TextChangedEventArgs e)
{
String color = HandleColor(ExtremeIIFillTextBox.Text, "ExtremeIIFill");
if (color != String.Empty)
{
ExtremeIIFillPreview.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString(color));
}
}
// Extreme III
private void ExtremeIIIFillTextBox_TextChanged(object sender, System.Windows.Controls.TextChangedEventArgs e)
{
String color = HandleColor(ExtremeIIIFillTextBox.Text, "ExtremeIIIFill");
if (color != String.Empty)
{
ExtremeIIIFillPreview.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString(color));
}
}
// Impossible
private void ImpossibleFillTextBox_TextChanged(object sender, System.Windows.Controls.TextChangedEventArgs e)
{
String color = HandleColor(ImpossibleFillTextBox.Text, "ImpossibleFill");
if (color != String.Empty)
{
ImpossibleFillPreview.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString(color));
}
}
// Very Easy
private void VeryEasyTColorButton_Click(object sender, RoutedEventArgs e)
{
if (sender is Button toggleButton)
{
if (toggleButton.Background == Brushes.White)
{
toggleButton.Background = Brushes.Black;
toggleButton.Foreground = Brushes.White;
SaveToIni("Color", "VeryEasyWText", "True");
}
else
{
toggleButton.Background = Brushes.White;
toggleButton.Foreground = Brushes.Black;
SaveToIni("Color", "VeryEasyWText", "False");
}
}
}
// Easy
private void EasyTColorButton_Click(object sender, RoutedEventArgs e)
{
if (sender is Button toggleButton)
{
if (toggleButton.Background == Brushes.White)
{
toggleButton.Background = Brushes.Black;
toggleButton.Foreground = Brushes.White;
SaveToIni("Color", "EasyWText", "True");
}
else
{
toggleButton.Background = Brushes.White;
toggleButton.Foreground = Brushes.Black;
SaveToIni("Color", "EasyWText", "False");
}
}
}
// Normal
private void NormalTColorButton_Click(object sender, RoutedEventArgs e)
{
if (sender is Button toggleButton)
{
if (toggleButton.Background == Brushes.White)
{
toggleButton.Background = Brushes.Black;
toggleButton.Foreground = Brushes.White;
SaveToIni("Color", "NormalWText", "True");
}
else
{
toggleButton.Background = Brushes.White;
toggleButton.Foreground = Brushes.Black;
SaveToIni("Color", "NormalWText", "False");
}
}
}
// Hard
private void HardTColorButton_Click(object sender, RoutedEventArgs e)
{
if (sender is Button toggleButton)
{
if (toggleButton.Background == Brushes.White)
{
toggleButton.Background = Brushes.Black;
toggleButton.Foreground = Brushes.White;
SaveToIni("Color", "HardWText", "True");
}
else
{
toggleButton.Background = Brushes.White;
toggleButton.Foreground = Brushes.Black;
SaveToIni("Color", "HardWText", "False");
}
}
}
// Tough
private void ToughTColorButton_Click(object sender, RoutedEventArgs e)
{
if (sender is Button toggleButton)
{
if (toggleButton.Background == Brushes.White)
{
toggleButton.Background = Brushes.Black;
toggleButton.Foreground = Brushes.White;
SaveToIni("Color", "ToughWText", "True");
}
else
{
toggleButton.Background = Brushes.White;
toggleButton.Foreground = Brushes.Black;
SaveToIni("Color", "ToughWText", "False");
}
}
}
// Insane
private void InsaneTColorButton_Click(object sender, RoutedEventArgs e)
{
if (sender is Button toggleButton)
{
if (toggleButton.Background == Brushes.White)
{
toggleButton.Background = Brushes.Black;
toggleButton.Foreground = Brushes.White;
SaveToIni("Color", "InsaneWText", "True");
}
else
{
toggleButton.Background = Brushes.White;
toggleButton.Foreground = Brushes.Black;
SaveToIni("Color", "InsaneWText", "False");
}
}
}
// Extreme
private void ExtremeTColorButton_Click(object sender, RoutedEventArgs e)
{
if (sender is Button toggleButton)
{
if (toggleButton.Background == Brushes.White)
{
toggleButton.Background = Brushes.Black;
toggleButton.Foreground = Brushes.White;
SaveToIni("Color", "ExtremeWText", "True");
}
else
{
toggleButton.Background = Brushes.White;
toggleButton.Foreground = Brushes.Black;
SaveToIni("Color", "ExtremeWText", "False");
}
}
}
// Extreme II
private void ExtremeIITColorButton_Click(object sender, RoutedEventArgs e)
{
if (sender is Button toggleButton)
{
if (toggleButton.Background == Brushes.White)
{
toggleButton.Background = Brushes.Black;
toggleButton.Foreground = Brushes.White;
SaveToIni("Color", "ExtremeIIWText", "True");
}
else
{
toggleButton.Background = Brushes.White;
toggleButton.Foreground = Brushes.Black;
SaveToIni("Color", "ExtremeIIWText", "False");
}
}
}
// Extreme III
private void ExtremeIIITColorButton_Click(object sender, RoutedEventArgs e)
{
if (sender is Button toggleButton)
{
if (toggleButton.Background == Brushes.White)
{
toggleButton.Background = Brushes.Black;
toggleButton.Foreground = Brushes.White;
SaveToIni("Color", "ExtremeIIIWText", "True");
}
else
{
toggleButton.Background = Brushes.White;
toggleButton.Foreground = Brushes.Black;
SaveToIni("Color", "ExtremeIIIWText", "False");
}
}
}
// Impossible
private void ImpossibleTColorButton_Click(object sender, RoutedEventArgs e)
{
if (sender is Button toggleButton)
{
if (toggleButton.Background == Brushes.White)
{
toggleButton.Background = Brushes.Black;
toggleButton.Foreground = Brushes.White;
SaveToIni("Color", "ImpossibleWText", "True");
}
else
{
toggleButton.Background = Brushes.White;
toggleButton.Foreground = Brushes.Black;
SaveToIni("Color", "ImpossibleWText", "False");
}
}
}
private void AutoSortButton_Click(object sender, RoutedEventArgs e)
{
if (AutoSortButton.IsChecked == true)
{
SaveToIni("General", "AutoSort", "True");
}
else
{
SaveToIni("General", "AutoSort", "False");
}
}
private void MoreTierButton_Click(object sender, RoutedEventArgs e)
{
if (MoreTierButton.IsChecked == true)
{
SaveToIni("General", "MoreTier", "True");
}
else
{
SaveToIni("General", "MoreTier", "False");
}
}
private void VeryEasyNameTextBox_TextChanged(object sender, TextChangedEventArgs e)
{
SaveToIni("Color", "VeryEasyName", VeryEasyName.Text);
}
private void EasyNameTextBox_TextChanged(object sender, TextChangedEventArgs e)
{
SaveToIni("Color", "EasyName", EasyName.Text);
}
private void NormalNameTextBox_TextChanged(object sender, TextChangedEventArgs e)
{
SaveToIni("Color", "NormalName", NormalName.Text);
}
private void HardNameTextBox_TextChanged(object sender, TextChangedEventArgs e)
{
SaveToIni("Color", "HardName", HardName.Text);
}
private void ToughNameTextBox_TextChanged(object sender, TextChangedEventArgs e)
{
SaveToIni("Color", "ToughName", ToughName.Text);
}
private void InsaneNameTextBox_TextChanged(object sender, TextChangedEventArgs e)
{
SaveToIni("Color", "InsaneName", InsaneName.Text);
}
private void ExtremeNameTextBox_TextChanged(object sender, TextChangedEventArgs e)
{
SaveToIni("Color", "ExtremeName", ExtremeName.Text);
}
private void ExtremeIINameTextBox_TextChanged(object sender, TextChangedEventArgs e)
{
SaveToIni("Color", "ExtremeIIName", ExtremeIIName.Text);
}
private void ExtremeIIINameTextBox_TextChanged(object sender, TextChangedEventArgs e)
{
SaveToIni("Color", "ExtremeIIIName", ExtremeIIIName.Text);
}
private void ImpossibleNameTextBox_TextChanged(object sender, TextChangedEventArgs e)
{
SaveToIni("Color", "ImpossibleName", ImpossibleName.Text);
}
private void PresetButton_Click(object sender, RoutedEventArgs e)
{
Close();
var presetSelector = new ColorPresetSelector();
presetSelector.ShowDialog();
}
}
}