Exemplo n.º 1
0
        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);
            }
        }
Exemplo n.º 2
0
        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);
            }
        }
Exemplo n.º 3
0
        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;
            }
        }
Exemplo n.º 4
0
        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);
                }
            }
        }
Exemplo n.º 5
0
        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;
                }
            }
        }
Exemplo n.º 6
0
        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);
                }
            }
        }