Exemplo n.º 1
0
        //非自动感应手牌
        private void open_seat_noauto()
        {
            try
            {
                if (!seatlock)
                {
                    BathClass.printErrorMsg("未启用手牌锁");
                    return;
                }

                if (lock_type == "欧亿达")
                {
                    Thread.Sleep(500);
                    if (OYD.FKOPEN() != 1)
                    {
                        return;
                    }

                    OYD.CH375SetTimeout(0, 5000, 5000);
                }

                byte[] buff      = new byte[200];
                string seat_text = "";

                int rt = -1;
                if (lock_type == "欧亿达")
                {
                    Thread.Sleep(500);
                    rt = OYD.OYEDA_id(buff);
                }
                else if (lock_type == "锦衣卫")
                {
                    rt = JYW.ReadID(buff);
                }
                else if (lock_type == "RF")
                {
                    rt = RF.RF_RFID(ref seat_text);
                }

                if (rt != 0)
                {
                    return;
                }

                CSeat seat = null;
                if (lock_type == "欧亿达")
                {
                    seat_text = Encoding.Default.GetString(buff, 0, 20).Trim();
                    seat_text = seat_text.Substring(0, 16);
                }
                else if (lock_type == "锦衣卫")
                {
                    seat_text = BathClass.byteToHexStr(buff);
                    seat_text = seat_text.Substring(0, 16);
                }
                seat = dao.get_seat("oId", seat_text);

                if (seat == null)
                {
                    BathClass.printErrorMsg("手牌" + seat_text + "不存在");
                    return;
                }

                if (seat.status == SeatStatus.AVILABLE || seat.status == SeatStatus.PAIED)
                {
                    if (lock_type == "欧亿达")
                    {
                        Thread.Sleep(500);
                    }

                    if ((lock_type == "欧亿达" && OYD.OYEDA_fk(buff) != 0) ||
                        (lock_type == "锦衣卫" && JYW.FK(buff) != 0) ||
                        (lock_type == "RF" && RF.RF_FK(seat_text) != 0))
                    {
                        return;
                    }
                    if (!set_one_seat_status(seat))
                    {
                        return;
                    }
                    if (!m_Seats.Select(x => x.text).Contains(seat.text))
                    {
                        m_Seats.Add(seat);
                    }
                }
                else if (seat.status == SeatStatus.USING || seat.status == SeatStatus.DEPOSITLEFT)
                {
                    if (!m_Seats.Select(x => x.text).Contains(seat.text))
                    {
                        m_Seats.Add(seat);
                    }
                }
                dgv_show();
            }
            catch (System.Exception e)
            {
                MessageBox.Show(e.Message);
            }
        }
Exemplo n.º 2
0
        //手牌线程
        private void seat_card_thread()
        {
            while (true)
            {
                try
                {
                    if (_close)
                    {
                        break;
                    }
                    if (lock_type == "欧亿达")
                    {
                        Thread.Sleep(500);
                        if (OYD.FKOPEN() != 1)
                        {
                            continue;
                        }

                        OYD.CH375SetTimeout(0, 5000, 5000);
                    }

                    string seat_text = "";
                    byte[] buff      = new byte[200];

                    int rt = -1;
                    if (lock_type == "欧亿达")
                    {
                        Thread.Sleep(500);
                        rt = OYD.OYEDA_id(buff);
                    }
                    else if (lock_type == "锦衣卫")
                    {
                        rt = JYW.ReadID(buff);
                    }
                    else if (lock_type == "RF")
                    {
                        rt = RF.RF_RFID(ref seat_text);
                    }

                    if (rt != 0)
                    {
                        continue;
                    }

                    if (lock_type == "欧亿达")
                    {
                        seat_text = Encoding.Default.GetString(buff, 0, 20).Trim();
                        oId.Text  = seat_text.Substring(0, 16);
                    }
                    else if (lock_type == "锦衣卫")
                    {
                        seat_text = BathClass.byteToHexStr(buff);
                        oId.Text  = seat_text.Substring(0, 16);
                    }
                    else if (lock_type == "RF")
                    {
                        oId.Text = seat_text;
                    }
                }
                catch
                {
                    //this.Invoke(new delegate_print_msg(BathClass.printErrorMsg), new object[]{ex.Message});
                }
            }
        }
Exemplo n.º 3
0
        //手牌线程
        private void seat_card_thread()
        {
            while (true)
            {
                if (_close)
                {
                    break;
                }
                try
                {
                    if (lock_type == "欧亿达")
                    {
                        Thread.Sleep(500);
                        if (OYD.FKOPEN() != 1)
                        {
                            continue;
                        }

                        OYD.CH375SetTimeout(0, 5000, 5000);
                    }

                    byte[] buff      = new byte[200];
                    string seat_text = "";

                    int rt = -1;
                    if (lock_type == "欧亿达")
                    {
                        Thread.Sleep(500);
                        rt = OYD.OYEDA_id(buff);
                    }
                    else if (lock_type == "锦衣卫")
                    {
                        rt = JYW.ReadID(buff);
                    }
                    else if (lock_type == "RF")
                    {
                        rt = RF.RF_RFID(ref seat_text);
                    }

                    if (rt != 0)
                    {
                        continue;
                    }

                    CSeat seat = null;
                    if (lock_type == "欧亿达")
                    {
                        seat_text = Encoding.Default.GetString(buff, 0, 20).Trim();
                        seat_text = seat_text.Substring(0, 16);
                    }
                    else if (lock_type == "锦衣卫")
                    {
                        seat_text = BathClass.byteToHexStr(buff);
                        seat_text = seat_text.Substring(0, 16);
                    }
                    seat = dao.get_seat("oId", seat_text);

                    if (seat == null)
                    {
                        if (this.InvokeRequired)
                        {
                            this.Invoke(new delegate_print_msg(BathClass.printErrorMsg),
                                        new object[] { "手牌" + seat_text + "不存在" });
                        }
                        else
                        {
                            BathClass.printErrorMsg("手牌" + seat_text + "不存在");
                        }
                        continue;
                    }

                    if (seat.status == SeatStatus.AVILABLE || seat.status == SeatStatus.PAIED)
                    {
                        if (lock_type == "欧亿达")
                        {
                            Thread.Sleep(500);
                        }

                        if ((lock_type == "欧亿达" && OYD.OYEDA_fk(buff) != 0) ||
                            (lock_type == "锦衣卫" && JYW.FK(buff) != 0) ||
                            (lock_type == "RF" && RF.RF_FK(seat_text) != 0))
                        {
                            continue;
                        }

                        if (!set_one_seat_status(seat))
                        {
                            continue;
                        }
                        if (!m_Seats.Select(x => x.text).Contains(seat.text))
                        {
                            m_Seats.Add(seat);
                        }
                    }
                    else if (seat.status == SeatStatus.USING || seat.status == SeatStatus.DEPOSITLEFT)
                    {
                        if (!m_Seats.Select(x => x.text).Contains(seat.text))
                        {
                            m_Seats.Add(seat);
                        }
                    }
                    if (this.InvokeRequired)
                    {
                        this.Invoke(new delegate_dgv_show(dgv_show));
                    }
                    else
                    {
                        dgv_show();
                    }
                }
                catch (Exception ex)
                {
                }
            }
        }