コード例 #1
0
        private static void readInputAndChangeStatus(UnityContainer container)
        {
            IRFIDService rfidService = container.Resolve <IRFIDService>();
            String       command     = "";

            while (true)
            {
                Console.Write("Input a command:");
                command = Console.ReadLine();
                if (command == "start")
                {
                    rfidService.start();
                    Console.WriteLine("Start RFID!");
                }
                if (command == "stop")
                {
                    rfidService.stop();
                    Console.WriteLine("Stop RFID!");
                }
                if (command.StartsWith("set"))
                {
                    String[] strArray = command.Split(' ');
                    if (strArray.Length != 3)
                    {
                        continue;
                    }
                    rfidService.HardwareInterface = strArray[1];
                    rfidService.HardwareInterfaceConnectionSpeed = strArray[2];
                }
            }
        }
コード例 #2
0
        public void OnNavigatedFrom(NavigationContext navigationContext)
        {
            IRFIDService rfidService = container.Resolve <IRFIDService>();

            rfidService.stop();
            eventAggregator.GetEvent <RFIDNewItemEvent>().Unsubscribe(handleNewItemFromRFID);
            eventAggregator.GetEvent <RFIDHardwareEvent>().Unsubscribe(handleErrorFromRFID);
            eventAggregator.GetEvent <DatabaseEvent>().Unsubscribe(handleErrorFromDatabase);
        }
コード例 #3
0
        public void OnNavigatedFrom(NavigationContext navigationContext)
        {
            //throw new NotImplementedException();
            //取消订阅该事件,在此之前先关闭rfid后台扫描线程
            IRFIDService rfidService = container.Resolve <IRFIDService>();

            rfidService.stop();
            eventAggregator.GetEvent <RFIDNewItemEvent>().Unsubscribe(handleNewItemFromRFID);
            eventAggregator.GetEvent <RFIDHardwareEvent>().Unsubscribe(handleErrorFromRFID);
        }