Exemplo n.º 1
0
        private void Window_KeyDown(object sender, KeyEventArgs e)
        {
            ScaleSimHelper.RunSim();

            bool CtrlDown = System.Windows.Input.Keyboard.IsKeyDown(Key.LeftCtrl) || Keyboard.IsKeyDown(Key.RightCtrl);
            bool TDown    = Keyboard.IsKeyDown(Key.T);
            bool MDown    = Keyboard.IsKeyDown(Key.M);

            if (CtrlDown && TDown)
            {
                using (var dp = SimpleIoc.Default.GetInstance <IUnitOfWorkFactory>().CreateUnitOfWork())
                {
                    var truck   = dp.TruckRepository.GetAll().ToList().First();
                    var message = new TagItem {
                        AntennaePort = 1, Epc = truck.RFIDTagId, Firstseen = DateTime.UtcNow, Lastseen = DateTime.UtcNow
                    };
                    var listtags = new List <TagItem>();
                    listtags.Add(message);
                    Messenger.Default.Send <List <TagItem> >(listtags);
                }
            }
            else if (CtrlDown && MDown)
            {
                Task.Run(() =>
                {
                    TagDataProvider.SpoofRandomTag();
                    System.Threading.Thread.Sleep(200);
                    TagDataProvider.SpoofRandomTag();
                    System.Threading.Thread.Sleep(200);
                    TagDataProvider.SpoofRandomTag();
                    System.Threading.Thread.Sleep(200);
                    TagDataProvider.SpoofRandomTag();
                    System.Threading.Thread.Sleep(200);
                });
            }
        }
 private void Window_KeyDown(object sender, KeyEventArgs e)
 {
     ScaleSimHelper.RunSim();
 }