Ejemplo n.º 1
0
        public AdminManager()
        {
            InitializeComponent();

            //禁用取钱功能
            button2.IsEnabled = false;

            string SmartPayoutCom = ConfigurationManager.AppSettings["SmartPayoutCom"];

            Payout           = new CPayout();
            dTimer.Tick     += new EventHandler(dTimer_Tick);
            dTimer.Interval  = new TimeSpan(200);
            dTimer.IsEnabled = false;


            //init
            int reconnectionAttempts = 5;

            Payout.CommandStructure.ComPort    = SmartPayoutCom;
            Payout.CommandStructure.SSPAddress = 0;
            Payout.CommandStructure.Timeout    = 3000;


            // connect to validator
            if (ConnectToValidator(reconnectionAttempts))
            {
                dTimer.IsEnabled = true;
            }

            Payout.AdminSetChannelToPayout(LOGS);
            CheckPayoutCash();
            ShowCashBoxCount();
        }
Ejemplo n.º 2
0
        private void dTimer_Tick(object sender, EventArgs e)
        {
            CPayout.price = "";
            if (Payout.DoPoll(LOGS) == false)
            {
                while (true)
                {
                    Payout.SSPComms.CloseComPort();
                    if (ConnectToValidator(5) == true)
                    {
                        break;
                    }
                    Payout.SSPComms.CloseComPort();
                    return;
                }
            }
            else
            {
                if (CPayout.price != "")
                {
                    string[] s    = CPayout.price.Split('.');
                    int      cash = Int32.Parse(s[0]);
                    switch (cash)
                    {
                    case 1: payoutcash[0] += 1; break;

                    case 5: payoutcash[2] += 1; break;

                    case 10: payoutcash[3] += 1; break;

                    case 20: payoutcash[4] += 1; break;

                    case 50: payoutcash[5] += 1; break;

                    case 100: payoutcash[6] += 1; break;
                    }
                    if (payoutcash[0] > 5 || payoutcash[2] > 30 || payoutcash[3] > 30)
                    {
                        Payout.AdminSetChannelToPayout(LOGS);
                    }
                    ShowCashBoxCount();
                }
            }
        }