? | |||
Line 1: | Line 1: | ||
? | [[Category:Lang-Chinese]][[Category:Security on Windows Phone]][[Category:UI on Windows Phone]][[Category:Windows Phone 7.5]][[Category:Code Examples | + | [[Category:Lang-Chinese]][[Category:Security on Windows Phone]][[Category:UI on Windows Phone]][[Category:Windows Phone 7.5]][[Category:Code Examples]] |
? | {{ArticleMetaData <!-- v1.2 --> | ? | {{ArticleMetaData <!-- v1.2 --> |
? | |sourcecode= [[Media:EncryptionSample.zip]] | ? | |sourcecode= [[Media:EncryptionSample.zip]] |
Latest revision as of 14:29, 15 July 2013
????
????
??
??:
???????????????????????????????????????????????????/?????
[edit] ??
???????????????Windows Phone?????????????????????????????????????????????????????????????NavigationService.RemoveBackEntry, ???????????????????????????????????????????????
[edit] ????
????????????????????????
??????????????Loaded handler???
private void MainPage_Loaded(object sender, RoutedEventArgs e)
{
if (!app.IsAuthenticated)
{
p = new Popup();
LayoutRoot.Children.Add(p);
ApplicationBar.IsVisible = false;
?
// Set where the popup will show up on the screen.
p.VerticalOffset = 60;
p.HorizontalOffset = 25;
?
Border border = new Border();
border.BorderBrush = new SolidColorBrush(Colors.White);
border.BorderThickness = new Thickness(5.0);
?
StackPanel panel1 = new StackPanel();
panel1.Background = new SolidColorBrush(Colors.Black);
panel1.Width = LayoutRoot.ActualWidth - 2 * p.HorizontalOffset;
?
Button button1 = new Button();
button1.Content = "OK";
button1.Margin = new Thickness(5.0);
button1.Click += new RoutedEventHandler(loginbutton_Click);
TextBlock textblock1 = new TextBlock();
textblock1.TextWrapping = TextWrapping.Wrap;
if (app.FirstRun)
textblock1.Text = "Please enter your choice of a password:";
else
textblock1.Text = "Please enter your password";
textblock1.Margin = new Thickness(5.0);
textblock1.FontSize = 30;
textblock1.Foreground = new SolidColorBrush(Colors.White);
pb = new PasswordBox();
pb.KeyDown += new KeyEventHandler(pb_KeyDown);
panel1.Children.Add(textblock1);
panel1.Children.Add(pb);
panel1.Children.Add(button1);
border.Child = panel1;
?
// Set the Child property of Popup to the border
// which contains a stackpanel, textblock and button.
p.Child = border;
?
// Open the popup.
p.IsOpen = true;
pb.Focus();
}
else
// Set the data context of the listbox control to the sample data
DataContext = App.ViewModel;
}
????????????????????????
private void loginbutton_Click(object sender, RoutedEventArgs e)
{
// Close the popup.
p.IsOpen = false;
if (app.FirstRun)
{
app.PwdHash = CryptoUtil.GetHashCode(pb.Password);
app.IsAuthenticated = true;
app.FirstRun = false;
App.ViewModel.LoadData();
}
else
app.IsAuthenticated = CryptoUtil.GetHashCode(pb.Password).CompareTo(app.PwdHash) == 0;
?
if (app.IsAuthenticated)
{
DataContext = App.ViewModel;
ApplicationBar.IsVisible = true;
}
else
{
tb = new TextBlock();
tb.Text = "Wrong password.";
tb.FontSize = 36;
tb.Foreground = new SolidColorBrush(Colors.Red);
tb.Margin = new Thickness(12);
tb.SetValue(Grid.RowProperty, 2);
LayoutRoot.Children.Add(tb);
ApplicationBar.IsVisible = true;
(ApplicationBar.MenuItems[0] as ApplicationBarMenuItem).IsEnabled = false;
?
DataContext = null;
}
}
???????Enter??????????
void pb_KeyDown(object sender, KeyEventArgs e)
{
if (e.Key == Key.Enter)
loginbutton_Click(this, new RoutedEventArgs());
}
?????????????????????
private void PhoneApplicationPage_BackKeyPress(object sender, System.ComponentModel.CancelEventArgs e)
{
if (p.IsOpen)
{
loginbutton_Click(this, new RoutedEventArgs());
e.Cancel = true;
}
}
???????????????????????????????????????????????????????????????????????????How to encrypt your application data in Windows Phone?
[edit] ????
?????????????How to encrypt your application data in Windows Phone?????Media:EncryptionSample.zip ?
pinnacle airlines kansas vs kentucky oakland college basketball joe posnanski michael kidd gilchrist national championship
কোন মন্তব্য নেই:
একটি মন্তব্য পোস্ট করুন