public static void Main(string[] args) { Callback callback = new Callback(); NetTcpBinding binding = new NetTcpBinding(); binding.MaxReceivedMessageSize = int.MaxValue; binding.Security.Mode = SecurityMode.None; string address = "net.tcp://localhost:8080/Perfmon/"; DuplexChannelFactory <IPerfmonService> factory = new DuplexChannelFactory <IPerfmonService>(callback, binding, address); IPerfmonService service = factory.CreateChannel(); service.Join(); CategoryList categories = service.List(); categories.Sort((a, b) => a.Name.CompareTo(b.Name)); /* * foreach (Category category in categories) * { * Console.WriteLine(category.Name); * } */ service.Subscribe("Processor", "% Processor Time"); //service.Subscribe("Memory", "Available MBytes"); Console.ReadLine(); service.Leave(); }
private CategoryList TryList() { try { return(service.List()); } catch (CommunicationException) { return(new CategoryList()); } }