示例#1
0
 private void HooperManager_HopperStateInputEvent(byte[] res, CoinHopperCommands sentCommand)
 {
     if (sentCommand == CoinHopperCommands.REQUEST_PAYOUT_HIGH_LOW_STATUS)
     {
         var Data = res;
         var comd = sentCommand;
         Dispatcher.Invoke(DispatcherPriority.Normal, new Action(() =>
         {
             try
             {
                 var Dataresult = Utils.TVMUtility.Hex2Binary(Data[4].ToString());
                 var highorlow  = Dataresult.Substring(Dataresult.Length - 2);
                 var high       = highorlow[0];
                 var low        = highorlow[1];
                 if (Convert.ToInt16(high.ToString()) == 1)
                 {
                     level = "High Level";
                 }
                 else if (Convert.ToInt16(low.ToString()) == 1)
                 {
                     level = "Low Level";
                 }
                 else if (Convert.ToInt16(low.ToString()) == 0)
                 {
                     level = "Normal Level";
                 }
             }
             catch (Exception ex1)
             {
                 log.Error("Error PayByCashOrCoinPage -> HooperManager_HopperStateInputEvent() : " + ex1.ToString());
             }
         }));
     }
 }
        private void HooperManager_HopperStateInputEvent(byte[] res, CoinHopperCommands sentCommand)
        {
            try
            {
                log.Debug("Debug  HooperManager_HopperStateInputEvent : " + sentCommand);
                log.Debug("Debug  HooperManager_HopperStateInputEvent = res : " + res.Length);
                if (sentCommand == CoinHopperCommands.REQUEST_PAYOUT_HIGH_LOW_STATUS)
                {
                    var data = res;
                    var comd = sentCommand;
                    Dispatcher.Invoke(DispatcherPriority.Normal, new Action(() =>
                    {
                        var dataresult = Utils.TVMUtility.Hex2Binary(data[4].ToString());
                        var highorlow  = dataresult.Substring(dataresult.Length - 2);
                        var high       = highorlow[0];
                        var low        = highorlow[1];
                        if (Convert.ToInt16(high.ToString()) == 1)
                        {
                            level = "High Level";
                        }
                        else if (Convert.ToInt16(low.ToString()) == 1)
                        {
                            level = "Low Level";
                        }
                        else if (Convert.ToInt16(low.ToString()) == 0)
                        {
                            level = "Normal Level";
                        }
                    }));
                }

                if (sentCommand == CoinHopperCommands.REQUEST_HOPPER_STATUS)
                {
                    var data = res;
                    var comd = sentCommand;
                    coins_remaining = Convert.ToInt16(data[5].ToString());
                    coins_paid      = Convert.ToInt16(data[6].ToString());
                    coins_unpaid    = Convert.ToInt16(data[7].ToString());
                }
            }
            catch (Exception ex)
            {
                log.Error("Error CoinDispenserTestPage -> HooperManager_HopperStateInputEvent() : " + ex.ToString());
            }
        }