예제 #1
0
파일: ServiceHelper.cs 프로젝트: avs009/gsf
 /// <summary>
 /// Sends the specified resonse to the specified client only.
 /// </summary>
 /// <param name="clientID">ID of the client to whom the response is to be sent.</param>
 /// <param name="response">The response to be sent to the client.</param>
 public void SendResponse(Guid clientID, ServiceResponse response)
 {
     if (clientID == Guid.Empty)
     {
         // Multi-cast message to all connected clients if no client ID is specified
         m_remotingServer.Multicast(response);
     }
     else
     {
         // Send message directly to specified client
         m_remotingServer.SendTo(clientID, response);
     }
 }
예제 #2
0
파일: ServiceHelper.cs 프로젝트: avs009/gsf
 private void SendProcessStateChangedResponse(string processName, ProcessState currentState)
 {
     ServiceResponse serviceResponse = new ServiceResponse("PROCESSSTATECHANGED");
     serviceResponse.Attachments.Add(new ObjectState<ProcessState>(processName, currentState));
     SendResponse(serviceResponse);
 }
예제 #3
0
파일: ServiceHelper.cs 프로젝트: avs009/gsf
 /// <summary>
 /// Sends the specified response to all of the connected clients.
 /// </summary>
 /// <param name="response">The response to be sent to the clients.</param>
 public void SendResponse(ServiceResponse response)
 {
     SendResponse(Guid.Empty, response);
 }
예제 #4
0
파일: ServiceHelper.cs 프로젝트: avs009/gsf
 private void SendServiceStateChangedResponse(ServiceState currentState)
 {
     ServiceResponse serviceResponse = new ServiceResponse("SERVICESTATECHANGED");
     serviceResponse.Attachments.Add(new ObjectState<ServiceState>(Name, currentState));
     SendResponse(serviceResponse);
 }
예제 #5
0
파일: ServiceHelper.cs 프로젝트: avs009/gsf
 private void SendUpdateClientStatusResponse(Guid clientID, string response)
 {
     ServiceResponse serviceResponse = new ServiceResponse();
     serviceResponse.Type = "UPDATECLIENTSTATUS";
     serviceResponse.Message = response;
     SendResponse(clientID, serviceResponse);
 }
예제 #6
0
파일: ClientHelper.cs 프로젝트: avs009/gsf
 /// <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));
 }
예제 #7
0
파일: ServiceHelper.cs 프로젝트: avs009/gsf
 private void SendUpdateClientStatusResponse(Guid clientID, UpdateType type, string response)
 {
     ServiceResponse serviceResponse = new ServiceResponse();
     serviceResponse.Type = "UPDATECLIENTSTATUS-" + type.ToString().ToUpper();
     serviceResponse.Message = response;
     SendResponse(clientID, serviceResponse);
 }
예제 #8
0
파일: ServiceHelper.cs 프로젝트: avs009/gsf
 /// <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)
         {
             // Send message directly to specified client.
             m_remotingServer.SendToAsync(client, response);
         }
         else
         {
             // Send message to all of the connected clients.
             if (m_remoteCommandClientID == Guid.Empty)
             {
                 lock (m_remoteClients)
                 {
                     foreach (ClientInfo clientInfo in m_remoteClients)
                     {
                         m_remotingServer.SendToAsync(clientInfo.ClientID, response);
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
         // Log the exception.
         m_errorLogger.Log(ex);
     }
 }