private void tsbtnConnect_Click(object sender, EventArgs e) { string address = ""; if (rbtnIP.Checked) { if (tbxIP.Text == String.Empty) { MessageBox.Show("Please Input IP Address!"); return; } RFIDReaderParameter.IP = tbxIP.Text.Trim(); address = RFIDReaderParameter.IP; } else if (rbtnHostname.Checked) { if (tbxMAC1.Text == String.Empty || tbxMAC2.Text == String.Empty || tbxMAC3.Text == String.Empty) { MessageBox.Show("Please complete Hostname!"); return; } RFIDReaderParameter.Hostname = String.Format(@"speedwayr-{0}-{1}-{2}.local", tbxMAC1.Text.Trim(), tbxMAC2.Text.Trim(), tbxMAC3.Text.Trim()); address = RFIDReaderParameter.Hostname; } Console.WriteLine("Connectting to Reader..."); //Update Status tsslblStatus.Text = ReaderStatus.Connecting.ToString(); tsslblStatus.Image = Properties.Resources.status_connecting; // Create a LLRPClient instance. _reader = new LLRPClient(); //Impinj Best Practice! Always Install the Impinj extensions Impinj_Installer.Install(); ENUM_ConnectionAttemptStatusType status; bool ret = _reader.Open(address, 2000, out status); // Check for a connection error if (!ret || status != ENUM_ConnectionAttemptStatusType.Success) { // Could not connect to the reader; Print out the error Console.WriteLine("Failed to Connect to Reader!"); if (status.ToString() == "-1") { tsslblStatus.Text = "Wrong Address"; } else { tsslblStatus.Text = status.ToString(); } tsslblStatus.Image = Properties.Resources.status_stop; MessageBox.Show(tsslblStatus.Text, "Connection Error"); RFIDReaderParameter.IsConnected = false; _reader.Close(); return; } else { //Connect to the reader successfully Console.WriteLine("Succeeded to Connect to Reader!"); tsslblStatus.Text = ReaderStatus.Connected.ToString(); tsslblStatus.Image = Properties.Resources.status_ready; tsbtnConnect.Enabled = false; tsbtnStart.Enabled = true; tsbtnMoreSettings.Enabled = true; cbResetToFactoryDefault.Enabled = true; gbReadMode.Enabled = true; gbFrequencyInfo.Enabled = true; gbTagFilter.Enabled = true; RFIDReaderParameter.IsConnected = true; _readerSettings = new ReaderSettings(this, _reader); _readerSettings.AddEventHandler(); _readerSettings.Enable_Impinj_Extensions(); _readerSettings.GetReaderCapabilities(); new RFIDReaderParameter(); _readerSettings.UpdateUISettings(); } }