private void ClientHelper_ReceivedServiceUpdate(object sender, EventArgs <UpdateType, string> e) { string connectionString = ((ClientHelper)sender).RemotingClient.ConnectionString; string nodeID = string.Empty; foreach (Node node in nodeList) { if (node.RemoteStatusServiceUrl == connectionString) { nodeID = node.ID; break; } } ServiceUpdateMessage message = new ServiceUpdateMessage() { ServiceUpdateType = e.Argument1, ServiceUpdate = e.Argument2 }; PushServiceStatusToClients(nodeID, message); }
private void ClientHelper_ReceivedServiceUpdate(object sender, EventArgs<UpdateType, string> e) { string connectionString = ((ClientHelper)sender).RemotingClient.ConnectionString; string nodeID = string.Empty; foreach (Node node in nodeList) { if (node.RemoteStatusServiceUrl == connectionString) { nodeID = node.ID; break; } } ServiceUpdateMessage message = new ServiceUpdateMessage() { ServiceUpdateType = e.Argument1, ServiceUpdate = e.Argument2 }; PushServiceStatusToClients(nodeID, message); }
private void ClientHelper_ReceivedServiceResponse(object sender, EventArgs<ServiceResponse> e) { string response = e.Argument.Type; string message = e.Argument.Message; string responseToClient = string.Empty; UpdateType responseType = UpdateType.Information; string connectionString = ((ClientHelper)sender).RemotingClient.ConnectionString; string nodeID = string.Empty; if (!string.IsNullOrEmpty(response)) { // Reponse types are formatted as "Command:Success" or "Command:Failure" string[] parts = response.Split(':'); string action; bool success; if (parts.Length > 1) { action = parts[0].Trim().ToTitleCase(); success = (string.Compare(parts[1].Trim(), "Success", true) == 0); } else { action = response; success = true; } if (success) { if (string.IsNullOrEmpty(message)) responseToClient = string.Format("{0} command processed successfully.\r\n\r\n", action); else responseToClient = string.Format("{0}\r\n\r\n", message); } else { responseType = UpdateType.Alarm; if (string.IsNullOrEmpty(message)) responseToClient = string.Format("{0} failure.\r\n\r\n", action); else responseToClient = string.Format("{0} failure: {1}\r\n\r\n", action, message); } foreach (Node node in nodeList) { if (node.RemoteStatusServiceUrl == connectionString) { nodeID = node.ID; break; } } ServiceUpdateMessage msg = new ServiceUpdateMessage() { ServiceUpdateType = responseType, ServiceUpdate = responseToClient }; PushServiceStatusToClients(nodeID, msg); } }
private void ClientHelper_ReceivedServiceResponse(object sender, EventArgs <ServiceResponse> e) { string response = e.Argument.Type; string message = e.Argument.Message; string responseToClient = string.Empty; UpdateType responseType = UpdateType.Information; string connectionString = ((ClientHelper)sender).RemotingClient.ConnectionString; string nodeID = string.Empty; if (!string.IsNullOrEmpty(response)) { // Reponse types are formatted as "Command:Success" or "Command:Failure" string[] parts = response.Split(':'); string action; bool success; if (parts.Length > 1) { action = parts[0].Trim().ToTitleCase(); success = (string.Compare(parts[1].Trim(), "Success", true) == 0); } else { action = response; success = true; } if (success) { if (string.IsNullOrEmpty(message)) { responseToClient = string.Format("{0} command processed successfully.\r\n\r\n", action); } else { responseToClient = string.Format("{0}\r\n\r\n", message); } } else { responseType = UpdateType.Alarm; if (string.IsNullOrEmpty(message)) { responseToClient = string.Format("{0} failure.\r\n\r\n", action); } else { responseToClient = string.Format("{0} failure: {1}\r\n\r\n", action, message); } } foreach (Node node in nodeList) { if (node.RemoteStatusServiceUrl == connectionString) { nodeID = node.ID; break; } } ServiceUpdateMessage msg = new ServiceUpdateMessage() { ServiceUpdateType = responseType, ServiceUpdate = responseToClient }; PushServiceStatusToClients(nodeID, msg); } }