Beispiel #1
0
 private void btnReadOnce_Click(object sender, EventArgs e)
 {
     try
     {
         int TotalTagCount = 0;
         btnReadOnce.Enabled = false;
         TagReadData[] tagID = objReader.Read(int.Parse(tbxReadTimeout.Text));
         arr = new ReadTags[tagID.Length];
         for (int i = 0; i < tagID.Length; i++)
         {
             arr[i]        = new ReadTags(tagID[i]);
             TotalTagCount = TotalTagCount + tagID[i].ReadCount;
         }
         dataGrid1.DataSource = arr;
         generatedatagrid();
         lblTotalTagCount.Text  = TotalTagCount.ToString();
         lblUniqueTagCount.Text = tagID.Length.ToString();
         btnReadOnce.Enabled    = true;
         btnReadOnce.Focus();
     }
     catch (IOException ex)
     {
         MessageBox.Show(ex.Message, "Error");
         objReader.Destroy();
         objReader           = null;
         btnReadOnce.Enabled = false;
         btnConnect.Text     = "Connect";
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Reader Message");
         btnReadOnce.Enabled = true;
     }
 }
Beispiel #2
0
        private void btnReadOnce_Click(object sender, EventArgs e)
        {
            try
            {
                int TotalTagCount = 0;
                btnReadOnce.Enabled = false;
                TagReadData[] tagID = objReader.Read(int.Parse(tbxReadTimeout.Text));
                arr = new ReadTags[tagID.Length];
                for (int i = 0; i < tagID.Length; i++)
                {
                    arr[i] = new ReadTags(tagID[i]);
                    TotalTagCount = TotalTagCount + tagID[i].ReadCount;
                }
                dataGrid1.DataSource = arr;
                generatedatagrid();
                lblTotalTagCount.Text = TotalTagCount.ToString();
                lblUniqueTagCount.Text = tagID.Length.ToString();
                btnReadOnce.Enabled = true;
                btnReadOnce.Focus();

            }
            catch (IOException ex)
            {
                MessageBox.Show(ex.Message, "Error");
                objReader.Destroy();
                objReader = null;
                btnReadOnce.Enabled = false;
                btnConnect.Text = "Connect";
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Reader Message");
                btnReadOnce.Enabled = true;
            }

        }