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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Navigation;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
using Microsoft.Devices.Sensors;
using File360.Resources;
using System.IO.IsolatedStorage;
using System.Windows.Media;
using System.Windows.Input;
namespace File360
{
public partial class SecurityPage : PhoneApplicationPage
{
IsolatedStorageSettings appSettings = IsolatedStorageSettings.ApplicationSettings;
public SecurityPage()
{
InitializeComponent();
if (!Accelerometer.IsSupported)
{
shake.IsEnabled = false;
}
Shaker_Checker();
pb.Background = (SolidColorBrush)Resources["PhoneBackgroundBrush"];
pb.Foreground = (SolidColorBrush)Resources["PhoneForegroundBrush"];
pb.BorderBrush = (SolidColorBrush)Resources["PhoneBackgroundBrush"];
pb.InputScope = new InputScope { Names = { new InputScopeName { NameValue = InputScopeNameValue.Number } } };
}
void pb_GotFocus(object sender, RoutedEventArgs e)
{
pb.Background = (SolidColorBrush)Resources["PhoneBackgroundBrush"];
pb.Foreground = (SolidColorBrush)Resources["PhoneForegroundBrush"];
pb.MaxLength = 5;
pb.BorderBrush = (SolidColorBrush)Resources["PhoneBackgroundBrush"];
pb.TextAlignment = TextAlignment.Center;
}
#region ToggleSwitcher
private void shake_Checked(object sender, RoutedEventArgs e)
{
appSettings["Shaker"] = "On";
appSettings.Save();
}
private void shake_Unchecked(object sender, RoutedEventArgs e)
{
appSettings["Shaker"] = "Off";
appSettings.Save();
}
private void passw_Checked(object sender, RoutedEventArgs e)
{
appSettings["Passer"] = "On";
}
private void passw_Unchecked(object sender, RoutedEventArgs e)
{
appSettings["Passer"] = "Off";
}
private void PSetter(object sender, TextChangedEventArgs e)
{
appSettings["PasswordValue"] = pb.Text;
}
#endregion
#region SettingsUpdater
public void Shaker_Checker()
{
if ((string)appSettings["Shaker"] == "On")
{
shake.IsChecked = true;
}
if ((string)appSettings["Shaker"] == "Off")
{
shake.IsChecked = false;
}
if ((string)appSettings["Passer"] == "On")
{
passw.IsChecked = true;
}
if ((string)appSettings["Passer"] == "Off")
{
passw.IsChecked = false;
}
}
#endregion
private void Video_Tap(object sender, EventArgs e)
{
NavigationService.Navigate(new Uri("/VideoPlayer.xaml", UriKind.Relative));
}
}
}