-
Notifications
You must be signed in to change notification settings - Fork 0
/
Widget1Settings.xaml.cs
145 lines (123 loc) · 4.64 KB
/
Widget1Settings.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
using Microsoft.Gaming.XboxGameBar;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
// 빈 페이지 항목 템플릿에 대한 설명은 https://go.microsoft.com/fwlink/?LinkId=234238에 나와 있습니다.
namespace MurbongCrosshair
{
/// <summary>
/// 자체적으로 사용하거나 프레임 내에서 탐색할 수 있는 빈 페이지입니다.
/// </summary>
public sealed partial class Widget1Settings : Page
{
byte r = 0, g = 255, b = 0;
public Widget1Settings()
{
this.InitializeComponent();
}
private void CenterScreen_Click(object sender, RoutedEventArgs e)
{
Widget1.CenterScreen();
}
private void Color_ValueChanged(object sender, RangeBaseValueChangedEventArgs e)
{
var slider = sender as Slider;
if (slider == Color_Red)
r = (byte)Color_Red.Value;
else if (slider == Color_Green)
g = (byte)Color_Green.Value;
else if (slider == Color_Blue)
b = (byte)Color_Blue.Value;
if (ColorPreview != null)
ColorPreview.Background = new SolidColorBrush(Color.FromArgb(255, r, g, b));
Widget1.crosshair.Color = Color.FromArgb(255, r, g, b);
Widget1.SettingEvent();
}
private void Alpha_ValueChanged(object sender, RangeBaseValueChangedEventArgs e)
{
var slider = sender as Slider;
Widget1.crosshair.Alpha = (byte)slider.Value;
Widget1.SettingEvent();
}
private void Thickness_ValueChanged(object sender, RangeBaseValueChangedEventArgs e)
{
var slider = sender as Slider;
Widget1.crosshair.Thickness = (float)slider.Value;
Widget1.SettingEvent();
}
private void Size_ValueChanged(object sender, RangeBaseValueChangedEventArgs e)
{
var slider = sender as Slider;
Widget1.crosshair.Size = (int)slider.Value;
Widget1.SettingEvent();
}
private void Gap_ValueChanged(object sender, RangeBaseValueChangedEventArgs e)
{
var slider = sender as Slider;
Widget1.crosshair.Gap = (int)slider.Value;
Widget1.SettingEvent();
}
private void Page_Loaded(object sender, RoutedEventArgs e)
{
}
protected override void OnNavigatedTo(NavigationEventArgs e)
{
if (Widget1.crosshair != null)
{
var color = Widget1.crosshair.Colors;
Outline.Value = Widget1.crosshair.Outline;
Gap.Value = Widget1.crosshair.Gap;
Dot_Box.IsChecked = Widget1.crosshair.EnableDot;
T_Box.IsChecked = Widget1.crosshair.EnableTShape;
Thickness.Value = Widget1.crosshair.Thickness;
Alpha.Value = Widget1.crosshair.Alpha;
Size.Value = Widget1.crosshair.Size;
Color_Red.Value = r = color.R;
Color_Green.Value = g = color.G;
Color_Blue.Value = b = color.B;
}
}
private void OutlineCheck_Unchecked(object sender, RoutedEventArgs e)
{
Debug.WriteLine("hello");
var checkbox = sender as CheckBox;
if (checkbox.IsChecked == false)
{
Outline.Value = 0;
Widget1.crosshair.Outline = 0;
}
Widget1.SettingEvent();
}
private void T_Box_Checked(object sender, RoutedEventArgs e)
{
var checkbox = sender as CheckBox;
Widget1.crosshair.EnableTShape = (bool)checkbox.IsChecked;
Widget1.SettingEvent();
}
private void Outline_ValueChanged(object sender, RangeBaseValueChangedEventArgs e)
{
var slider = sender as Slider;
Widget1.crosshair.Outline = (int)slider.Value;
Widget1.SettingEvent();
}
private void DotCheckBox_Checked(object sender, RoutedEventArgs e)
{
var checkbox = sender as CheckBox;
Widget1.crosshair.EnableDot = (bool)(checkbox.IsChecked);
Widget1.SettingEvent();
}
}
}