void automation_UnlockObject(object sender, AnnLockObjectEventArgs e) { e.Cancel = true; //PasswordDialog AutomationPasswordDialog passwordDialog = new AutomationPasswordDialog(); if (passwordDialog.ShowDialog(this) == DialogResult.OK) { e.Object.Unlock(passwordDialog.Password); AnnObject checkObject = null; AnnSelectionObject selectionObject = e.Object as AnnSelectionObject; if (selectionObject != null) { if (selectionObject.SelectedObjects.Count > 0) { //checking first object is enough checkObject = selectionObject.SelectedObjects[0]; } } else { checkObject = e.Object; } if (checkObject.IsLocked) { MessageBox.Show("You've entered an invalid password.", "Invalid Password", MessageBoxButtons.OK, MessageBoxIcon.Warning); } Automation.Invalidate(LeadRectD.Empty); } }
void automation_LockObject(object sender, AnnLockObjectEventArgs e) { AutomationPasswordDialog passwordDialog = new AutomationPasswordDialog(); passwordDialog.Lock = true; if (passwordDialog.ShowDialog(this) == DialogResult.OK) { e.Object.Lock(passwordDialog.Password); } }
void _annAutomation_LockObject(object sender, AnnLockObjectEventArgs e) { AutomationPasswordDialog passwordDialog = new AutomationPasswordDialog(); passwordDialog.Lock = true; if (passwordDialog.ShowDialog(this) == DialogResult.OK) { e.Password = passwordDialog.Password; } else { e.Cancel = true; } }
void automation_UnlockObject(object sender, AnnLockObjectEventArgs e) { //PasswordDialog AutomationPasswordDialog passwordDialog = new AutomationPasswordDialog(); if (passwordDialog.ShowDialog(this) == DialogResult.OK) { e.Object.Unlock(passwordDialog.Password); if (e.Object.IsLocked) { MessageBox.Show("You've entered an invalid password.", "Invalid Password", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } }
private void automation_LockObject(object sender, AnnLockObjectEventArgs e) { var automation = _documentViewer.Annotations.Automation; if (automation == null) { return; } using (var dlg = new AutomationPasswordDialog()) { dlg.Lock = true; if (dlg.ShowDialog(this) == DialogResult.OK) { e.Password = dlg.Password; } else { e.Cancel = true; } } }
private void automation_UnlockObject(object sender, AnnLockObjectEventArgs e) { var automation = _documentViewer.Annotations.Automation; if (automation == null) { return; } e.Cancel = true; using (var dlg = new AutomationPasswordDialog()) { if (dlg.ShowDialog(this) == DialogResult.OK) { e.Object.Unlock(dlg.Password); if (e.Object.IsLocked) { UI.Helper.ShowWarning(this, "Invalid password"); } automation.Invalidate(LeadRectD.Empty); } } }