private void InitializeProxy(string IpAddress, CallBackFunctionSignature callback) { try { Url = string.Format("net.tcp://{0}:8001/KryptonService", IpAddress); _callback = callback; InstanceContext context = new InstanceContext(this); NetTcpBinding binding = new NetTcpBinding(SecurityMode.None); binding.MaxReceivedMessageSize = 2147483647; binding.ReaderQuotas.MaxDepth= 2147483647; binding.ReaderQuotas.MaxStringContentLength=2147483647; binding.ReaderQuotas.MaxArrayLength= 2147483647; binding.ReaderQuotas.MaxBytesPerRead= 2147483647; binding.ReaderQuotas.MaxNameTableCharCount = 2147483647; binding.OpenTimeout = TimeSpan.FromMinutes(10); binding.SendTimeout = TimeSpan.FromMinutes(20); binding.ReceiveTimeout = TimeSpan.FromMinutes(20); binding.MaxBufferPoolSize = 2147483647; _proxy = new KryptonServiceProxy(context, binding, Url); _proxy.Open(); } catch (Exception ex) { Console.WriteLine(ex.Message); _proxy = null; } }
static void Main(string[] args) { string command ="C:\\Krypton\\Krypton.exe \"Browser=chrome\" \"TestCaseId=Demo.0001\"\r\n exit"; string ip = "localhost"; CallBackFunctionSignature callback = new CallBackFunctionSignature(CallBackFunction); ServiceAgent agent = new ServiceAgent(); agent.ExecuteCommand(ip, command, callback); Console.WriteLine("Press any key to stop execution..."); Console.ReadLine(); }
public void ExecuteCommand(string IpAddress, string command, CallBackFunctionSignature callback) { InitializeProxy(IpAddress, callback); ExecuteCommand(command); }