private void handleTagsReported(List <TagItem> tagsReported)
        {
            try
            {
                TagsInBuffer     = TagDataProvider.TagsInBuffer();
                LastSerialNumber = tagsReported.Last().SerialNumber;

                foreach (var tag in tagsReported)
                {
                    Logging.Logger.Log("INFO", "EPC: " + tag.Epc + " SN: " + tag.SerialNumber + " ANTENNA PORT: " + tag.AntennaePort.ToString() + " FIRST SEEN LOCAL TIME: " + tag.Firstseen.ToLocalTime().ToString() + " PEAK RSSI: " + tag.PeakRSSI.ToString() + " PHASE ANGLE: " + tag.PhaseAngle.ToString());
                }
            }
            catch (Exception exc)
            {
                Logging.Logger.Log(exc);
                Logging.Logger.WriteBuffer();
            }
        }
        public void Initialize(TruckEntity selectedTruck)
        {
            Logging.Logger.Log("INFO", "Entering Weighin Initialize");
            //lock (_dataLocker)
            //{
            _activeTruck = selectedTruck;
            using (var dp = SimpleIoc.Default.GetInstance <IUnitOfWorkFactory>().CreateUnitOfWork())
            {
                isUnattendedMode = bool.Parse(dp.SettingsRepository.GetSettingWithDefault(BridgeSettingKeys.UNATTENDED_MODE, "FALSE"));

                GinName         = dp.SettingsRepository.GetSettingWithDefault(BridgeSettingKeys.GIN_NAME, "");
                _allTrucks      = dp.TruckRepository.GetAll().ToList();
                WelcomeMessage  = selectedTruck.Name + " PULLING ONTO SCALE";
                IsSplitWeight   = _activeTruck.IsSemi;
                IsSplitCanceled = !_activeTruck.IsSemi;
                _yellowLightOn  = false;
                zeroWeightCount = 0;
                if (TagDataProvider.TagsInBuffer() >= 1)
                {
                    TagDataProvider.SetGPOState(1, true);
                    _yellowLightOn = true;
                    TagDataProvider.SetGPOState(2, false);
                    TagDataProvider.SetGPOState(3, false);
                }

                timer           = new System.Timers.Timer();
                timer.Interval  = int.Parse(dp.SettingsRepository.GetSettingWithDefault(BridgeSettingKeys.WEIGH_IN_TIMEOUT, "30")) * 1000;
                timer.AutoReset = false;
                timer.Elapsed  += Timer_Elapsed;
                timer.Start();

                autoSaveTimer           = new System.Timers.Timer();
                autoSaveTimer.Interval  = int.Parse(dp.SettingsRepository.GetSettingWithDefault(BridgeSettingKeys.WEIGHT_AUTO_SAVE_TIMEOUT, "10")) * 60 * 1000;
                autoSaveTimer.AutoReset = false;
                autoSaveTimer.Elapsed  += AutoSaveTimer_Elapsed;;
                autoSaveTimer.Start();
            }

            _initialized = true;
            //}
        }
        private void Timer_Elapsed(object sender, ElapsedEventArgs e)
        {
            if (!executingTimer) //prevent long execution of handler from overlapping later callbacks
            {
                executingTimer = true;

                if (lastActivity.AddMinutes(2) < DateTime.Now)
                {
                    Messenger.Default.Send <InactiveMessage>(new InactiveMessage());
                }


                CurrentTime = DateTime.Now.ToString("MM/dd/yyyy hh:mm tt");

                if (String.IsNullOrEmpty(Version))
                {
                    Version = "VERSION " + Assembly.GetExecutingAssembly().GetName().Version.ToString();
                }

                //try to connect to reader
                if (AllowRFIDReaderConnect)
                {
                    connectToReader();
                }

                using (var dp = SimpleIoc.Default.GetInstance <IUnitOfWorkFactory>().CreateUnitOfWork())
                {
                    if (AllowBarcoderConnect)
                    {
                        connectBarCodeReader(dp);
                    }

                    if (AllowScaleConnect)
                    {
                        connectScaleReader(dp);
                    }
                }

                if (EnableProcessSync)
                {
                    if (!BridgeSyncProcessHelper.Initialized && !NavService.IsOpen(PageType.SETTINGS_PAGE)) //make sure sync timer is running but not if in first setup
                    {
                        BridgeSyncProcessHelper.Init();
                    }

                    if (BridgeSyncProcessHelper.SyncProcessRunning())
                    {
                        SyncStatus = "SYNCING";
                    }
                    else
                    {
                        SyncStatus = "WAITING";
                    }
                }

                if (AllowRFIDReaderConnect)
                {
                    TagsInBuffer = TagDataProvider.TagsInBuffer();
                }

                executingTimer = false;
            }
        }