/// <summary> /// Sent client request object to remote service…… /// </summary> /// <param name="Packaged">packaged data.</param> /// <returns>System.Collection.Generic.KeyValuePair</returns> public KeyValuePair <string, object> Request(IList <object> Packaged) { if (Packaged != null && ClientRequest != null && ClientRequest.IsConnected && !running) { //write the sending/receive data to log //ClientRequest.Iswrite = RenbarGUI.Properties.Settings.Default.IsWriteDataLog; // change signal status .. running = true; // send request object to remote server .. ClientRequest.Send(this.EnvSvr.Serialize(Packaged)); // wait for remote response …… object response = this.EnvSvr.Deserialize(ClientRequest.Receive()); if (response != null) { // change signal status .. running = false; // convert correct data type .. return((KeyValuePair <string, object>)response); } else { // change signal status .. running = false; return(new KeyValuePair <string, object>(string.Format("-Err {0}", DateTime.Now), null)); } } else { return(new KeyValuePair <string, object>(string.Format("-Err {0}", DateTime.Now), null)); } }