Example #1
0
        public MainWindow()
        {
            InitializeComponent();

            Logger.GetInstance().Log("CW: Connecting to database.");

            // Set up connection to database
            _tagDb.Connect();

            Logger.GetInstance().Log("CW: Connected to database.");

            // Set items source for grid
            dataGridSearch.ItemsSource = SearchEntries;

            // Set up reader communicator
            var reader = ReaderCommunicator.GetInstance();

            Logger.GetInstance().Log("CW: Connecting Reader.");
            reader.Connect();
            Logger.GetInstance().Log("CW: Connected Reader.");
            Logger.GetInstance().Log("CW: Activating scanning.");
            reader.ActivateScan();
            Logger.GetInstance().Log("CW: Scanning activated.");
            reader.NewTagScanned += ReaderOnNewTagScanned;
        }
Example #2
0
        private void buttonStop_Click(object sender, EventArgs e)
        {
            ReaderCommunicator rc = ReaderCommunicator.GetInstance();

            rc.DeactivateScan();
            rc.Disconnect();

            buttonStart.Text          = "Starten";
            toolStripStatusLabel.Text = "Status: gestoppt. Eventuell noch Tags in Communicator gespeichert!";
        }
Example #3
0
        private void buttonStart_Click(object sender, EventArgs e)
        {
            if (buttonStart.Text.Equals("Starten"))
            {
                ReaderCommunicator rc = ReaderCommunicator.GetInstance();
                Logger.GetInstance().Log("F1: Received Instance of ReaderCommunicator");
                rc.Connect();
                Logger.GetInstance().Log("F1: Connected Reader Communicator");
                rc.ActivateScan();
                Logger.GetInstance().Log("F1: Activated Scanning");

                while (rc.Scanning == false)
                {
                } // wait for Scanner to start

                toolStripStatusLabel.Text = "Status: gestartet";

                buttonStart.Text = "Update Scanned Tags";
            }
            else
            {
                ReaderCommunicator rc = ReaderCommunicator.GetInstance();
                Logger.GetInstance().Log("F1: Received Instance of Reader Communicator");

                Dictionary <string, string> scannedTags = rc.GetScannedTags();
                Logger.GetInstance().Log("F1: Called Method GetScannedTags");

                if (scannedTags.Count > 0)
                {
                    Logger.GetInstance().Log($"F1: Received {scannedTags.Count} scanned Tags");

                    listBox.BeginUpdate();      // stop redrawing of the listbox while adding items

                    foreach (var item in scannedTags)
                    {
                        listBox.Items.Add($"Key: {item.Key} | Value: {item.Value}");
                    }
                    listBox.EndUpdate();        // start redrawing the listbox again
                }
            }
        }