Exemplo n.º 1
0
        private void dpc_PasswordChanged(object sender, PasswordChangedEventArgs e)
        {
            _TempSettings.Protection.PasswordString = e.NewPassword;
            cmdChangePwrd.IsEnabled = cmdRemovePwrd.IsEnabled = chkStoreEncrypted.IsEnabled = chkHideTrayIcon.IsEnabled = true;
            cmdCreatePwrd.IsEnabled = false;

            if (sender.GetType() == typeof(WndPasswordCreate))
            {
                var dlgPasswordCreate = sender as WndPasswordCreate;
                if (dlgPasswordCreate != null)
                    dlgPasswordCreate.PasswordChanged -= dpc_PasswordChanged;
            }
            else
            {
                var dlgPasswordChange = sender as WndPasswordChange;
                if (dlgPasswordChange != null)
                    dlgPasswordChange.PasswordChanged -= dpc_PasswordChanged;
            }
        }
Exemplo n.º 2
0
 private void dpc_PasswordChanged(object sender, PasswordChangedEventArgs e)
 {
     try
     {
         var password = e.NewPassword;
         if (sender.GetType() == typeof(WndPasswordCreate))
         {
             var dlgPasswordCreate = sender as WndPasswordCreate;
             if (dlgPasswordCreate != null)
                 dlgPasswordCreate.PasswordChanged -= dpc_PasswordChanged;
             PNStatic.Settings.Protection.PasswordString = password;
         }
         else
         {
             var dlgPasswordChange = sender as WndPasswordChange;
             if (dlgPasswordChange != null)
                 dlgPasswordChange.PasswordChanged -= dpc_PasswordChanged;
             if (PNStatic.Settings.Protection.StoreAsEncrypted)
             {
                 PNNotesOperations.DecryptAllNotes(PNStatic.Settings.Protection.PasswordString);
             }
             PNStatic.Settings.Protection.PasswordString = password;
             if (PNStatic.Settings.Protection.StoreAsEncrypted)
             {
                 PNNotesOperations.EncryptAllNotes(PNStatic.Settings.Protection.PasswordString);
             }
         }
         PNData.SavePassword();
     }
     catch (Exception ex)
     {
         PNStatic.LogException(ex);
     }
 }
Exemplo n.º 3
0
 private void pwrdCreate_PasswordChanged(object sender, PasswordChangedEventArgs e)
 {
     try
     {
         var pwrdCreate = sender as WndPasswordCreate;
         if (pwrdCreate != null) pwrdCreate.PasswordChanged -= pwrdCreate_PasswordChanged;
         var group = PNStatic.Groups.GetGroupByID(_SelectedGroup);
         if (group != null)
         {
             group.PasswordString = e.NewPassword;
             PNData.SaveGroupPassword(group);
             changeNodeText(_LastTreeItem, group.ID);
             updateNotesAfterGroupPasswordChange(group);
         }
     }
     catch (Exception ex)
     {
         PNStatic.LogException(ex);
     }
 }
Exemplo n.º 4
0
 private void notePasswordSet(object sender, PasswordChangedEventArgs e)
 {
     try
     {
         var pwrdCrweate = sender as WndPasswordCreate;
         if (pwrdCrweate != null) pwrdCrweate.PasswordChanged -= notePasswordSet;
         var note = getSelectedNote();
         if (note == null) return;
         PNNotesOperations.ApplyBooleanChange(note, NoteBooleanTypes.Password, true, e.NewPassword);
         if (note.Visible && note.Dialog != null)
         {
             note.Dialog.PFooter.SetMarkButtonVisibility(MarkType.Password, true);
         }
     }
     catch (Exception ex)
     {
         PNStatic.LogException(ex);
     }
 }