public void CallBackFunction(string functionType, string clientAddress, string functonName) { try { string s=string.Empty; if (functionType == "Identity") { MachineIdentity(); } else if (functionType == "GetFunction") { List<string> FunctionList= getFunctions(); foreach (string fcn in FunctionList) // Loop through List with foreach. { s=s+","+fcn; } InstanceContext context = new InstanceContext(this); proxy = new ServiceClient(context); proxy.UpdateData(s.TrimStart(','), clientAddress); } else if (functionType == "ExecuteFunction") { Console.WriteLine(functonName+" Command executed."); } } catch (Exception ex) { Program.logger.Error(ex.Message.ToString()); } }