Ejemplo n.º 1
0
        private void btnHotCloseDevice_Click(object sender, EventArgs e)
        {
            string port = this.txtHotPort.Text.Trim();

            if (port.StartsWith("lpt"))
            {
                if (helper.Close())
                {
                    this.btnHotOpenDevice.Enabled    = true;
                    this.btnHotCloseDevice.Enabled   = false;
                    this.btnHotGetState.Enabled      = false;
                    this.btnBeginPrint.Enabled       = false;
                    this.btnEndPrint.Enabled         = false;
                    this.btnPrintCommandOnce.Enabled = false;
                    this.lbOperationHint.Text        = "关闭并口成功!";
                }
                else
                {
                    this.lbOperationHint.Text = "关闭并口失败!";
                }
            }
            else
            {
                if (helper2.Close())
                {
                    this.btnHotOpenDevice.Enabled    = true;
                    this.btnHotCloseDevice.Enabled   = false;
                    this.btnHotGetState.Enabled      = false;
                    this.btnBeginPrint.Enabled       = false;
                    this.btnEndPrint.Enabled         = false;
                    this.btnPrintCommandOnce.Enabled = false;
                    this.lbOperationHint.Text        = "关闭串口成功!";
                }
                else
                {
                    this.lbOperationHint.Text = "关闭串口失败!";
                }
            }
        }