예제 #1
0
 private void cmdChangePwrd_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         // if new password has been applied or old password has not been changed - show standard password changing dialog
         if (PNStatic.Settings.Protection.PasswordString == _TempSettings.Protection.PasswordString)
         {
             var dpc = new WndPasswordChange();
             dpc.PasswordChanged += dpc_PasswordChanged;
             var showDialog = dpc.ShowDialog();
             if (showDialog == null || !showDialog.Value)
             {
                 dpc.PasswordChanged -= dpc_PasswordChanged;
             }
         }
         else
         {
             // if new password has not been applied and old password is empty - show standard password creation dialog
             if (PNStatic.Settings.Protection.PasswordString.Trim().Length == 0)
             {
                 var dpc = new WndPasswordCreate();
                 dpc.PasswordChanged += dpc_PasswordChanged;
                 var showDialog = dpc.ShowDialog();
                 if (showDialog == null || !showDialog.Value)
                 {
                     dpc.PasswordChanged -= dpc_PasswordChanged;
                 }
             }
             else
             {
                 // otherwise show standard password changing dialog using old password
                 var dpc = new WndPasswordChange();
                 dpc.PasswordChanged += dpc_PasswordChanged;
                 var showDialog = dpc.ShowDialog();
                 if (showDialog == null || !showDialog.Value)
                 {
                     dpc.PasswordChanged -= dpc_PasswordChanged;
                 }
             }
         }
     }
     catch (Exception ex)
     {
         PNStatic.LogException(ex);
     }
 }
예제 #2
0
 private void actionChangePassword()
 {
     try
     {
         var dpc = new WndPasswordChange { Owner = this };
         dpc.PasswordChanged += dpc_PasswordChanged;
         var showDialog = dpc.ShowDialog();
         if (showDialog == null || !showDialog.Value)
         {
             dpc.PasswordChanged -= dpc_PasswordChanged;
         }
     }
     catch (Exception ex)
     {
         PNStatic.LogException(ex);
     }
 }