// The method which fires the Event private void OnConnectionStatus_EventSendOut(DetectingConnection_EventSendOut e) { if (DetectingConnection_EventSendOut != null) { DetectingConnection_EventSendOut(this, e); // 觸發DetectingConnection_EventSendOut 事件 } }
private void ConnectingAction() { ScaningDeviceTimer.Stop(); IsCommunicationPortOpen = true; // If anyone has subscribed, notify them DetectingConnection_EventSendOut event_arg = new DetectingConnection_EventSendOut(IsCommunicationPortOpen); OnConnectionStatus_EventSendOut(event_arg); DetectingDeviceOffLineTimer.Start(); }