VaultPage.xaml.cs (2560B)
1 using File360.Common; 2 using System; 3 using System.Collections.Generic; 4 using System.IO; 5 using System.Linq; 6 using System.Runtime.InteropServices.WindowsRuntime; 7 using Windows.Foundation; 8 using Windows.Foundation.Collections; 9 using Windows.Graphics.Display; 10 using Windows.UI.ViewManagement; 11 using Windows.UI.Xaml; 12 using Windows.UI.Xaml.Controls; 13 using Windows.UI.Xaml.Controls.Primitives; 14 using Windows.UI.Xaml.Data; 15 using Windows.UI.Xaml.Input; 16 using Windows.UI.Xaml.Media; 17 using Windows.UI.Xaml.Navigation; 18 19 // The Basic Page item template is documented at http://go.microsoft.com/fwlink/?LinkID=390556 20 21 namespace File360 22 { 23 /// <summary> 24 /// An empty page that can be used on its own or navigated to within a Frame. 25 /// </summary> 26 public sealed partial class VaultPage : Page 27 { 28 string PASS_KEY = "2580"; 29 public VaultPage() 30 { 31 this.InitializeComponent(); 32 Loaded += VaultPage_Loaded; 33 } 34 35 private void VaultPage_Loaded(object sender, RoutedEventArgs e) 36 { 37 passwordBox.Focus(FocusState.Pointer); 38 //int btNo = 0; 39 //for (int i = 0; i <= 3; i++) 40 //{ 41 // for (int j = 0; j < 3; j++) 42 // { 43 // btNo++; 44 // Button bt = new Button(); 45 // bt.Content = btNo; 46 // bt.HorizontalAlignment = HorizontalAlignment.Stretch; 47 // bt.VerticalAlignment = VerticalAlignment.Stretch; 48 // bt.Click += (o, t) => 49 // { 50 // passwordBox.Text += bt.Content; 51 // }; 52 // Grid.SetRow(bt, i); 53 // Grid.SetColumn(bt, j); 54 // passwordGrid.Children.Add(bt); 55 // } 56 //} 57 } 58 59 private void passwordBox_TextChanged(object sender, TextChangedEventArgs e) 60 { 61 if (passwordBox.Text.Count() == 4 && passwordBox.Text != PASS_KEY) 62 { 63 AuthenticationFailed.Begin(); 64 passwordBox.Text = ""; 65 } 66 } 67 68 private void Grid_Tapped(object sender, TappedRoutedEventArgs e) 69 { 70 e.Handled = true; 71 passwordBox.Focus(FocusState.Pointer); 72 } 73 74 private void passwordBox_LostFocus(object sender, RoutedEventArgs e) 75 { 76 ((Grid)(((Grid)this.Frame.Parent).Parent)).Visibility = Visibility.Collapsed; 77 this.Frame.Content = null; 78 79 } 80 } 81 }