-
Notifications
You must be signed in to change notification settings - Fork 0
/
SettingsPage.xaml.cs
204 lines (183 loc) · 6.71 KB
/
SettingsPage.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
using System;
using Windows.Storage;
using Windows.UI.Core;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
namespace FileEx
{
public sealed partial class SettingsPage : Page
{
ApplicationDataContainer settings = ApplicationData.Current.LocalSettings;
public SettingsPage()
{
this.InitializeComponent();
Loaded += SettingsPage_Loaded;
SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Visible;
SystemNavigationManager.GetForCurrentView().BackRequested += SettingsPage_BackRequested;
}
private void SettingsPage_BackRequested(object sender, BackRequestedEventArgs e)
{
if (this.Frame.CanGoBack) this.Frame.GoBack();
}
private void SettingsPage_Loaded(object sender, RoutedEventArgs e)
{
#region SettingsSerializer
if (settings.Containers.Count == 9)
{
settings.Values["musicPlayer"] = "1";
musicToggle.IsChecked = true;
settings.Values["picturesPlayer"] = "1";
picturesToggle.IsChecked = true;
settings.Values["videoPlayer"] = "1";
videosToggle.IsChecked = true;
settings.Values["ebookViewer"] = "1";
ebookToggle.IsChecked = true;
settings.Values["itemType"] = 1;
typeComboBox.SelectedIndex = 1;
settings.Values["musThumbnail"] = "0";
musThumbnailToggle.IsChecked = false;
settings.Values["vidThumbnail"] = "0";
vidThumbnailToggle.IsChecked = false;
settings.Values["picThumbnail"] = "0";
picThumbnailToggle.IsChecked = false;
}
else
{
musicToggle.IsChecked = ((string)settings.Values["musicPlayer"] == "1");
picturesToggle.IsChecked = ((string)settings.Values["picturesPlayer"] == "1");
videosToggle.IsChecked = ((string)settings.Values["videosPlayer"] == "1");
ebookToggle.IsChecked = ((string)settings.Values["ebookViewer"] == "1");
typeComboBox.SelectedIndex = (int)(settings.Values["itemType"]);
musThumbnailToggle.IsChecked = ((string)settings.Values["musThumbnail"] == "1");
vidThumbnailToggle.IsChecked = ((string)settings.Values["vidThumbnail"] == "1");
picThumbnailToggle.IsChecked = ((string)settings.Values["picThumbnail"] == "1");
}
#endregion
#region InitializePasswordButtons
for (int i = 1; i <= 9; i++)
{
Button b = new Button();
b.Content = i;
try
{
b.Height = (Window.Current.Bounds.Width / 3) - 40;
b.Width = Window.Current.Bounds.Width / 3;
}
catch
{
}
b.Click += B_Click;
wrapPanel.Children.Add(b);
}
#endregion
}
#region SettingsHandler
#region Bluetooth
private async void OpenBluetoothSettings(object sender, RoutedEventArgs e)
{
await Windows.System.Launcher.LaunchUriAsync(new Uri("ms-settings-bluetooth:"));
}
#endregion
#region HelpMenu
private void HelpOpen(object sender, RoutedEventArgs e)
{
this.Frame.Navigate(typeof(HelpPage));
}
#endregion
#region FTP
private void OpenFTP(object sender, RoutedEventArgs e)
{
//FTPOpen.Begin();
}
#endregion
#region Music
private void musicToggle_Checked(object sender, RoutedEventArgs e)
{
settings.Values["musicPlayer"] = "1";
}
private void musicToggle_Unchecked(object sender, RoutedEventArgs e)
{
settings.Values["musicPlayer"] = "0";
}
private void musThumbnailToggle_Checked(object sender, RoutedEventArgs e)
{
settings.Values["musThumbnail"] = "1";
}
private void musThumbnailToggle_Unchecked(object sender, RoutedEventArgs e)
{
settings.Values["musThumbnail"] = "0";
}
#endregion
#region Videos
private void videosToggle_Checked(object sender, RoutedEventArgs e)
{
settings.Values["videosPlayer"] = "1";
}
private void videosToggle_Unchecked(object sender, RoutedEventArgs e)
{
settings.Values["videosPlayer"] = "0";
}
private void vidThumbnailToggle_Checked(object sender, RoutedEventArgs e)
{
settings.Values["vidThumbnail"] = "1";
}
private void vidThumbnailToggle_Unchecked(object sender, RoutedEventArgs e)
{
settings.Values["vidThumbnail"] = "0";
}
#endregion
#region Ebooks
private void ebookToggle_Checked(object sender, RoutedEventArgs e)
{
settings.Values["ebookViewer"] = "1";
}
private void ebookToggle_Unchecked(object sender, RoutedEventArgs e)
{
settings.Values["ebookViewer"] = "0";
}
#endregion
#region Pictures
private void picturesToggle_Checked(object sender, RoutedEventArgs e)
{
settings.Values["picturesPlayer"] = "1";
}
private void picturesToggle_Unchecked(object sender, RoutedEventArgs e)
{
settings.Values["picturesPlayer"] = "0";
}
private void picThumbnailToggle_Checked(object sender, RoutedEventArgs e)
{
settings.Values["picThumbnail"] = "1";
}
private void picThumbnailToggle_Unchecked(object sender, RoutedEventArgs e)
{
settings.Values["picThumbnail"] = "0";
}
#endregion
#region Folder
private void FolderViewChanged(object sender, SelectionChangedEventArgs e)
{
settings.Values["itemType"] = typeComboBox.SelectedIndex;
}
#endregion
#region Security
private void PasswordToggle(object sender, RoutedEventArgs e)
{
ToggleSwitch ts = (ToggleSwitch)sender;
if (ts.IsOn)
{
wrapPanel.Visibility = Visibility.Visible;
}
else
{
wrapPanel.Visibility = Visibility.Visible;
}
}
private void B_Click(object sender, RoutedEventArgs e)
{
securityBlock.Text += ((Button)sender).Content;
}
#endregion
#endregion
}
}