예제 #1
0
        /// <summary>
        /// Второй этап запуска - стартуем асинхронные задачи
        /// </summary>
        /// <returns></returns>
        private void RunAfterInit()
        {
            if (CurrentDeviceSettings.UseKKT)
            {
                CashDeskHelper.CashDesk_Init();
            }
            MDB.ConnectMDBSerialPort(CashDeskDeviceID);
            I2c_Init();
#pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
            ServiceTasks.UpdateWaterCounter(0);
            ServiceTasks.UpdateCashCounter(0, 0, 0, 0);
#pragma warning restore CS4014             // Because this call is not awaited, execution of the current method continues before the call is completed
            AddItemToLogBox("Управляющее устройство успешно инициализировано, продолжаем...");
            int initdelaymillisec = 10000; //подождем немного, винде нужно время, чтобы выделить память, отсвопиться своим гавном
                                           //на SD-карту и успокоиться.
            while (initdelaymillisec > 0)
            {
                AddItemToLogBox("Ожидание запуска задач " + (initdelaymillisec / 1000).ToString() + "с...");
                int count = 0;
                while (count < 100)
                {
                    Task.Delay(100).Wait();
                    count++;
                }
                initdelaymillisec -= 10000;
            }
            //Task.Run(CCC, GlobalCancellationTokenSource.Token);
            ServiceTasks.StartAll();
            AddItemToLogBox("Задачи запущены");
            Task.Run(MDBHelper.Init_MDB);
        }
예제 #2
0
        /// <summary>
        /// Вставлена купюра
        /// </summary>
        /// <param name="BillValue"></param>
        private static void CashDevices_MDBInsertedBill(double BillValue)
        {
            StartPage.AddItemToLogBox("Прием купюры ₽" + BillValue.ToString("N2"));
#pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
            ServiceTasks.UpdateCashCounter(0, 0, 1, (int)BillValue);
#pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
            if ((StartPage.CurrentState == StartPage.States.ReadyToServe) || (StartPage.CurrentState == StartPage.States.ReadyToDispenseWater))
            {
                StartPage.UserDeposit += BillValue;
            }
        }
예제 #3
0
        /// <summary>
        /// Монета помещена в кэшбокс
        /// </summary>
        /// <param name="CoinValue"></param>
        private static void CashDevices_MDBInsertedCoinRoutedToCashBox(double CoinValue)
        {
            StartPage.AddItemToLogBox("Монета помещена в кэшбокс ₽" + CoinValue.ToString("N2"));
#pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
            ServiceTasks.UpdateCashCounter(1, CoinValue, 0, 0);
#pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
            if ((StartPage.CurrentState == StartPage.States.ReadyToServe) || (StartPage.CurrentState == StartPage.States.ReadyToDispenseWater))
            {
                StartPage.UserDeposit += CoinValue;
            }
        }
예제 #4
0
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
#pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
            ServiceTasks.UpdateCashCounter(1, 0.5, 1, 100, 2, 1, 3, 1);
#pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
        }
예제 #5
0
        /// <summary>
        /// Обрабатываем сведения о состоянии трубок монетоприемника
        /// </summary>
        /// <param name="RUR1"></param>
        /// <param name="RUR2"></param>
        /// <param name="RUR5"></param>
        /// <param name="RUR10"></param>
        private static void CashDevices_MDBCCTubesStatus(int RUR1, int RUR2, int RUR5, int RUR10)
        {
#pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
            ServiceTasks.UpdateCashCounter(0, 0, 0, 0, RUR10, RUR5, RUR2, RUR1);
#pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
        }
예제 #6
0
        /// <summary>
        /// Обрабатываем сведения о состоянии трубок монетоприемника
        /// </summary>
        private static void CashDevices_MDBCCTubesStatus(List <MDB.CoinChangerTubeRecord> CoinChangerTubeRecords)
        {
#pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
            ServiceTasks.UpdateCashCounter(0, 0, 0, 0, CoinChangerTubeRecords.First(x => (int)x.CoinValue == 1).CoinsCount, CoinChangerTubeRecords.First(x => (int)x.CoinValue == 2).CoinsCount, CoinChangerTubeRecords.First(x => (int)x.CoinValue == 5).CoinsCount, CoinChangerTubeRecords.First(x => (int)x.CoinValue == 10).CoinsCount);
#pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
        }