예제 #1
0
        private void UnLockPrinter()
        {
            try
            {
                FrmPassword  frmPassword  = new FrmPassword(false);
                DialogResult dialogResult = frmPassword.ShowDialog();

                if (dialogResult == DialogResult.OK)
                {
                    string unLockPassword = frmPassword.Password;
                    _printer.UnLock(unLockPassword);

                    if (IsCurrentPrinterLocked() == false)
                    {
                        MessageBox.Show("Printer is unlocked.", "LEADTOOLS Printer Demo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else
                    {
                        MessageBox.Show("Incorrect password.", "LEADTOOLS Printer Demo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                }
            }
            catch (Exception Ex)
            {
                MessageBox.Show(Ex.Message, "LEADTOOLS Printer Demo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
예제 #2
0
        private void LockPrinter()
        {
            try
            {
                FrmPassword  frmPassword  = new FrmPassword(true);
                DialogResult dialogResult = frmPassword.ShowDialog();

                if (dialogResult == DialogResult.OK)
                {
                    string lockPassword = frmPassword.Password;
                    _printer.Lock(lockPassword);

                    if (IsCurrentPrinterLocked())
                    {
                        MessageBox.Show("Printer is locked.  You will no longer be able to print to it.", "LEADTOOLS Printer Demo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                    else
                    {
                        MessageBox.Show("Incorrect password.", "LEADTOOLS Printer Demo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                }
            }
            catch (Exception Ex)
            {
                MessageBox.Show(Ex.Message, "LEADTOOLS Printer Demo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }