/// <summary> /// Raises the <see cref="ReceivedServiceResponse"/> event. /// </summary> /// <param name="response"><see cref="ServiceResponse"/> received.</param> protected virtual void OnReceivedServiceResponse(ServiceResponse response) { if (ReceivedServiceResponse != null) ReceivedServiceResponse(this, new EventArgs<ServiceResponse>(response)); }
/// <summary> /// Sends the specified <paramref name="response"/> to the specified <paramref name="client"/> only. /// </summary> /// <param name="client">ID of the client to whom the <paramref name="response"/> is to be sent.</param> /// <param name="response">The <see cref="ServiceResponse"/> to be sent to the <paramref name="client"/>.</param> public void SendResponse(Guid client, ServiceResponse response) { try { if (client == Guid.Empty) { // Multicast message to all clients. if (m_remoteCommandClientID == Guid.Empty) // Process if remote command session is not in progress. m_remotingServer.MulticastAsync(response); } else { // Send message directly to specified client. m_remotingServer.SendToAsync(client, response); } } catch (Exception ex) { // Log the exception. m_errorLogger.Log(ex); } }
/// <summary> /// Sends the specified <paramref name="response"/> to all <see cref="RemoteClients"/>. /// </summary> /// <param name="response">The <see cref="ServiceResponse"/> to be sent to all <see cref="RemoteClients"/>.</param> public void SendResponse(ServiceResponse response) { SendResponse(Guid.Empty, response); }
private void SendProcessStateChangedResponse(string processName, ServiceProcessState currentState) { ServiceResponse serviceResponse = new ServiceResponse("PROCESSSTATECHANGED"); serviceResponse.Attachments.Add(new ObjectState<ServiceProcessState>(processName, currentState)); SendResponse(serviceResponse); }
private void SendServiceStateChangedResponse(ServiceState currentState) { ServiceResponse serviceResponse = new ServiceResponse("SERVICESTATECHANGED"); serviceResponse.Attachments.Add(new ObjectState<ServiceState>(Name, currentState)); SendResponse(serviceResponse); }
private void SendUpdateClientStatusResponse(Guid clientID, string response) { ServiceResponse serviceResponse = new ServiceResponse(); serviceResponse.Type = "UPDATECLIENTSTATUS"; serviceResponse.Message = response; SendResponse(clientID, serviceResponse); }