private void DoCmdSetPasswords() { SecureString confirmedOpenPassword = null; SecureString confirmedEditPassword = null; if (this.SetOpenPassword == true) { GenericMessageAction <MsgShowConfirmPassword, bool> message = new GenericMessageAction <MsgShowConfirmPassword, bool>( new MsgShowConfirmPassword(this._openPassword, PasswordTypes.Open), x => confirmedOpenPassword = (x == true) ? this._openPassword : null); Messenger.Default.Send(message); } if (this.SetEditPassword == true) { GenericMessageAction <MsgShowConfirmPassword, bool> message = new GenericMessageAction <MsgShowConfirmPassword, bool>( new MsgShowConfirmPassword(this._editPassword, PasswordTypes.Edit), x => confirmedEditPassword = (x == true) ? this._editPassword : null); Messenger.Default.Send(message); } if ((confirmedOpenPassword != null) || (confirmedEditPassword != null)) { string tempFileName = String.Format(App.Current.FindResource("loc_tempEncrypted").ToString(), System.IO.Path.GetFileNameWithoutExtension(this._doc.FileName)) + System.IO.Path.GetExtension(this._doc.FileName); string tempFile = System.IO.Path.Combine(App.TEMP_DIR, tempFileName); PDFActions pdfActions = new PDFActions(); PDFActions.OperationStates state = pdfActions.Encrypt(this._doc, confirmedOpenPassword, confirmedEditPassword, this.AllowPrinting, this.AllowDegradatedPrinting, this.AllowModifyContents, this.AllowAssembly, this.AllowCopyContents, this.AllowScreenReaders, this.AllowModifyAnnotations, this.AllowFillIn, this.AllowAll, ref tempFile); this.Close(tempFile); } }