コード例 #1
0
 private void BtnSaveNewUnlock_Click(object sender, RoutedEventArgs e)
 {
     if (appvm != null)
     {
         if (tbNewUnlockPassword.SecurePassword.Length == 0)
         {
             tbUnlockTip.Foreground = tbSetUnlock.Foreground;
             tbUnlockTip.Text       = "* new master password is empty";
         }
         var result = appvm.ChangeUnlock(tbUnlockPassword.SecurePassword, tbNewUnlockPassword.SecurePassword, swNewScope.IsChecked ? DataProtectionScope.CurrentUser : DataProtectionScope.LocalMachine);
         if (result)
         {
             if (!appvm.IsUnlocked)
             {
                 tbUnlockTip.Foreground = tbUnlock.Foreground;
                 tbUnlockTip.Text       = "* incorrect old master password or new master password, try again";
             }
             else
             {
                 appvm.InvokeUnlocked();
             }
         }
         else
         {
             Close();
         }
     }
 }