public void OpenPort() { if (IsOpen) { return; } if (!m_Port.Open(TheProfile, DefaultTimeout)) { OpenPortResult?.Invoke(new TimeoutException("打开端口失败")); } }
private void Port_Open(Exception e) { if (e != null) { OpenPortResult?.Invoke(e); return; } IsOpen = true; if (!(DistanceEnabled || IlluminanceEnabled || ShakingEnabled || ConnectivityEnabled)) { State = AlarmingState.Unarmed; } else { State = AlarmingState.None; } OpenPortResult?.Invoke(null); ProfileKeeper.SaveProfile(TheProfile); }