private void savePasswordOk(object sender, RoutedEventArgs e)
 {
     if (passwordSaveBox.Password.Length < 6)
     {
         MessageBox.Show("Password must be 6 or more characters");
         passwordSaveBox.Password = "";
     }
     else
     {
         saveFilePopup.IsOpen = false;
         SaveFileDialog saveFile = new SaveFileDialog();
         saveFile.Filter = "UpRev Files|*.UpRev";
         if (saveFile.ShowDialog() == true)
         {
             using (var fileStream = File.Create(saveFile.FileName))
             {
                 TextRange range = new TextRange(rtbEditor.Document.ContentStart, rtbEditor.Document.ContentEnd);
                 range.Save(fileStream, DataFormats.Rtf);
             }
             if (PasswordVerification.isPasswordProtected(saveFile.FileName))
             {
                 PasswordVerification.updatePassword(saveFile.FileName);
             }
             string saveId      = IDVerification.getId();
             string newFileName = saveFile.FileName.Insert(0, saveId);
             string newPassword = passwordSaveBox.Password.Insert(0, saveId);
             Properties.Settings.Default.FileNames.Add(newFileName);
             Properties.Settings.Default.Passwords.Add(newPassword);
             Properties.Settings.Default.Save();
             Properties.Settings.Default.Reload();
             clearSaveItems();
         }
     }
 }
        private void openPasswordOk(object sender, RoutedEventArgs e)
        {
            string password = passwordOpenBox.Password.Insert(0, id);

            checkProtection = PasswordVerification.verifyPassword(password);
            if (checkProtection == "Verified" || checkProtection == "Not protected")
            {
                openFileActions(lastOpenedFile);
                clearOpenItems();
            }
            else
            {
                clearOpenItems();
                MessageBox.Show("Incorrect password. Try again.");
            }
        }