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);
     }
 }
 private void cmdCreatePwrd_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         // if there is no password - 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, if password has been deleted but not applied yet, show password changing dialog using old password
             cmdChangePwrd.PerformClick();
         }
     }
     catch (Exception ex)
     {
         PNStatic.LogException(ex);
     }
 }
Exemple #3
0
 private void actionCreatePassword()
 {
     try
     {
         var dpc = new WndPasswordCreate { 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);
     }
 }
Exemple #4
0
 private void groupsActionPasswordCreate()
 {
     try
     {
         _LastTreeItem = _RightSelectedItem ?? tvwGroups.SelectedItem as PNTreeItem;
         if (_LastTreeItem == null) return;
         var gr = _RightSelectedItem != null ? _RightSelectedItem.Tag as PNGroup : getSelectedGroup();
         if (gr == null) return;
         var text = " [" + PNLang.Instance.GetCaptionText("group", "Group") + " \"" + gr.Name + "\"]";
         var pwrdCreate = new WndPasswordCreate(text) { Owner = this };
         pwrdCreate.PasswordChanged += pwrdCreate_PasswordChanged;
         _SelectedGroup = gr.ID;
         var showDialog = pwrdCreate.ShowDialog();
         if (showDialog == null || !showDialog.Value)
         {
             pwrdCreate.PasswordChanged -= pwrdCreate_PasswordChanged;
         }
     }
     catch (Exception ex)
     {
         PNStatic.LogException(ex);
     }
     finally
     {
         _LastTreeItem = null;
         _SelectedGroup = -1234;
     }
 }
Exemple #5
0
 private void actionSetPassword()
 {
     try
     {
         var note = getSelectedNote();
         if (note == null) return;
         var text = " [" + PNLang.Instance.GetCaptionText("note", "Note") + " \"" + note.Name + "\"]";
         var pwrdCrweate = new WndPasswordCreate(text)
         {
             Owner = this,
             WindowStartupLocation = WindowStartupLocation.CenterOwner
         };
         pwrdCrweate.PasswordChanged += notePasswordSet;
         var showDialog = pwrdCrweate.ShowDialog();
         if (showDialog == null || !showDialog.Value)
         {
             pwrdCrweate.PasswordChanged -= notePasswordSet;
         }
         loadNotePreview(note);
     }
     catch (Exception ex)
     {
         PNStatic.LogException(ex);
     }
 }