Example #1
0
 private void Connected(IDeviceBLE pDevice)
 {
     if (pDevice == null)
     {
         return;
     }
     Debug.WriteLine("Connected to device : " + pDevice.Name);
     AddDevice?.Invoke(pDevice);
 }
 private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         if (textBox2.Text.Trim().Length <= 0)
         {
             MessageBox.Show("请填写设备地址");
             return;
         }
         DetectionData theDetectionData = new DetectionData();
         theDetectionData.DeviceAddress      = textBox2.Text;
         theDetectionData.DeviceLine         = textBox18.Text;
         theDetectionData.detectionDataArray = new List <DetectionDataArray>();
         DetectionDataArray theDetectionDataArray = new DetectionDataArray();
         theDetectionDataArray.DetectionName   = textBox6.Text;
         theDetectionDataArray.DetectionNumber = textBox17.Text;
         theDetectionDataArray.DetectionRouteA = textBox3.Text;
         theDetectionDataArray.DetectionRouteB = textBox4.Text;
         theDetectionDataArray.DetectionRouteC = textBox5.Text;
         theDetectionData.detectionDataArray.Add(theDetectionDataArray);
         DetectionDataArray towDetectionDataArray = new DetectionDataArray();
         towDetectionDataArray.DetectionName   = textBox7.Text;
         towDetectionDataArray.DetectionNumber = textBox16.Text;
         towDetectionDataArray.DetectionRouteA = textBox10.Text;
         towDetectionDataArray.DetectionRouteB = textBox9.Text;
         towDetectionDataArray.DetectionRouteC = textBox8.Text;
         theDetectionData.detectionDataArray.Add(towDetectionDataArray);
         DetectionDataArray threeDetectionDataArray = new DetectionDataArray();
         threeDetectionDataArray.DetectionName   = textBox11.Text;
         threeDetectionDataArray.DetectionNumber = textBox15.Text;
         threeDetectionDataArray.DetectionRouteA = textBox14.Text;
         threeDetectionDataArray.DetectionRouteB = textBox13.Text;
         threeDetectionDataArray.DetectionRouteC = textBox12.Text;
         theDetectionData.detectionDataArray.Add(threeDetectionDataArray);
         if (theDetectionData != null && theDetectionData.detectionDataArray != null)
         {
             theAddDevice.Invoke(theDetectionData, textBox2.Text);
         }
     }
     catch (Exception msg)
     {
         HandleTool.LogWrite(msg);
     }
 }