Beispiel #1
0
        //连接读卡机
        private static bool connect_card_machine()
        {
            if (icdev > 0)
            {
                IC.ic_exit(icdev);
            }

            string card_port = IOUtil.get_config_by_key(ConfigKeys.KEY_CARD_PORT);
            string card_baud = IOUtil.get_config_by_key(ConfigKeys.KEY_CARD_BAUD);
            string no_hint   = IOUtil.get_config_by_key(ConfigKeys.KEY_CARD_NOHINT);

            if ((card_port == "" || card_baud == "") && (no_hint == "" || no_hint == "false"))
            {
                CardPortBaudForm cardPortBaudForm = new CardPortBaudForm();
                if (cardPortBaudForm.ShowDialog() != DialogResult.OK)
                {
                    return(false);
                }

                card_port = cardPortBaudForm.card_port.ToString();
                card_baud = cardPortBaudForm.card_baud.ToString();
            }

            if (card_port == "" || card_baud == "")
            {
                return(false);
            }

            Int16 port = Convert.ToInt16(card_port);
            int   baud = Convert.ToInt32(card_baud);

            icdev = IC.ic_init(port, baud);
            if (icdev <= 0)
            {
                BathClass.printErrorMsg("连接读卡器失败,请重试!");
                return(false);
            }
            return(true);
        }
Beispiel #2
0
        //连接读卡机
        private static bool connect_card_machine()
        {
            if (icdev > 0)
                IC.ic_exit(icdev);

            string card_port = IOUtil.get_config_by_key(ConfigKeys.KEY_CARD_PORT);
            string card_baud = IOUtil.get_config_by_key(ConfigKeys.KEY_CARD_BAUD);
            string no_hint = IOUtil.get_config_by_key(ConfigKeys.KEY_CARD_NOHINT);
            if ((card_port == "" || card_baud == "") && (no_hint == "" || no_hint == "false"))
            {
                CardPortBaudForm cardPortBaudForm = new CardPortBaudForm();
                if (cardPortBaudForm.ShowDialog() != DialogResult.OK)
                    return false;

                card_port = cardPortBaudForm.card_port.ToString();
                card_baud = cardPortBaudForm.card_baud.ToString();
            }

            if (card_port == "" || card_baud == "")
                return false;

            Int16 port = Convert.ToInt16(card_port);
            int baud = Convert.ToInt32(card_baud);
            icdev = IC.ic_init(port, baud);
            if (icdev <= 0)
            {
                BathClass.printErrorMsg("连接读卡器失败,请重试!");
                return false;
            }
            return true;
        }