private void TestBtn_Click(object sender, EventArgs e) { string original = Properties.Settings.Default.ServerAddress; try { Properties.Settings.Default.ServerAddress = ServerAddress.Text; GXDlmsAmi ami = new GXDlmsAmi(); ami.GetReaders(); MessageBox.Show(ServerAddress.Parent, "Connection succeeded."); } catch (Exception Ex) { MessageBox.Show(Ex.Message); } Properties.Settings.Default.ServerAddress = original; }
private void ReadersRefresh_Click(object sender, EventArgs e) { try { ReadersView.Items.Clear(); GXReaderInfo[] readers = ami.GetReaders(); foreach (GXReaderInfo it in readers) { ListViewItem li = ReadersView.Items.Add(it.Detected.ToString()); li.SubItems.Add(it.Guid.ToString()); li.SubItems.Add(it.Name); li.SubItems.Add(it.Generation.ToString()); li.SubItems.Add(it.Version); li.Tag = it; } } catch (Exception Ex) { MessageBox.Show(ReadersView.Parent, Ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }