/// <summary> /// 关闭串口 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void _TimerGetData_Disposed(object sender, EventArgs e) { if (_adam != null) { ControlFan(false); ControlHeart(false); ControlAlarmLamp(false); _adam.Close(); } if (_adam != null) { _adam.Close(); } }
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) { } }