private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) { isRun = false; seach.Abort(); try { if (isA) { adam.Close(); } if (isZ) { zigBee.Close(); } } catch (Exception) { } }
/// <summary> /// 释放设备资源 /// </summary> private void DevicesDispose() { zigBeeDeivce.Close(); if (adamDevices != null) { adamDevices.Close(); } GetAdam4150Data.Abort(); GetZigBeeData.Abort(); GetAdam4150Data = null; GetZigBeeData = null; }