public void Start() { ClientConnection client = ClientConnection.GetInstance(); client.SetupChannels(); IWcfPing channel = client.channels[0]; string result = channel.Ping(); tbSomething.Text = result; string content = client.SaveComputerInfo(0); Dictionary <string, string> dict = JsonConvert.DeserializeObject <Dictionary <string, string> >(content); testLabel.Content = dict["computerName"]; }
public void SetupChannels() { var binding = new BasicHttpBinding(BasicHttpSecurityMode.None); binding.MaxReceivedMessageSize = 4294967295; binding.TransferMode = TransferMode.Streamed; var factory = new ChannelFactory <IWcfPing>(binding); var uri = DiscoverChannel(); foreach (var item in uri.Endpoints) { EndpointAddress newEndpoint = new EndpointAddress(item.Address.Uri); IWcfPing newChannel = factory.CreateChannel(newEndpoint); channels.Add(newChannel); } }
public PartialViewResult LoadComputers() { try { ClientConnection client = ClientConnection.GetInstance(); List <Dictionary <string, string> > computers = new List <Dictionary <string, string> >(); List <List <string> > processes = new List <List <string> >(); for (int i = 0; i < client.channels.Count; i++) { IWcfPing channel = client.channels[i]; string content = client.SaveComputerInfo(i); Dictionary <string, string> dict = JsonConvert.DeserializeObject <Dictionary <string, string> >(content); computers.Add(dict); string processContent = client.SaveProccesses(i); List <string> names = JsonConvert.DeserializeObject <List <string> >(processContent); processes.Add(names); client.SaveScreenShot(i); } ViewBag.Computers = computers; ViewBag.Processes = processes; } catch { } return(PartialView("Loadcomputers")); }