public InventoryViewModel(ReaderService readerService)
        {
            _readerService = readerService;
            Func <bool> hasReader = () => _readerService.ConnectedReader != null;

            UpdateConfig = new RelayCommand(ConfigReader, () => hasReader() && ShouldUpdate);
            ScanBarcode  = new RelayCommand(() => _readerService.GetBarcode(_readerService.BarcodeConfig),
                                            hasReader);
            RunInventory = new RelayCommand(() => _readerService.GetInventory(_readerService.InventoryConfig),
                                            hasReader);

            _readerService.RegisterForConnectionEvents(this, msg =>
            {
                ShouldUpdate = true;
            });

            _readerService.RegisterTagListener((sender, e) =>
            {
                var i = e.Tags.Count();
                if (i > 0)
                {
                    LastEpc = e.Tags.ElementAt(i - 1).Epc;
                }
                if (e.Complete)
                {
                    ScanCount += 1;
                }
            });
            _readerService.RegisterBarcodeListener((sender, e) =>
            {
                if (!String.IsNullOrWhiteSpace(e.Barcode))
                {
                    LastBarcode = e.Barcode;
                }
            });
        }