static void Main(string[] args) { try { TestExecutive currentProgram = new TestExecutive(); MessageServer msgReciever = new MessageServer(); FileServer fileServer = new FileServer(); Console.WriteLine("\n(Main thread)Constructing host to download/upload files"); fileServer.CreateFileServiceHost("http://localhost:4140/ICommService/BasicHttp"); fileServer.open(); Console.WriteLine("\n(Main thread)Constructing host to communicate with client and repository"); msgReciever.CreateMessageServiceHost("http://localhost:8180/ICommService/BasicHttp"); msgReciever.open(); while (true) { Console.WriteLine("\n(Main thread)Recieveing message from client..."); Message msg = msgReciever.TryGetMessage("Client", string.Empty); Console.WriteLine("\n(Main thread)Recieved message from client."); Thread childTH = new Thread(() => { currentProgram.CLMsgProc(msg, msgReciever); }); childTH.Start(); } } catch (Exception except) { Console.Write("\n {0}\n\n", except.Message); } /////////////////////////////////////////////////////////////////////////////////////////// }
private void btnSetHost_Click(object sender, RoutedEventArgs e) { Console.WriteLine("Constructing host to communicate with TH and repository..."); msgReciever.CreateMessageServiceHost("http://localhost:8284/ICommService/BasicHttp"); msgReciever.open(); Console.WriteLine("Constructing host to download/upload files..."); fileServer.CreateFileServiceHost("http://localhost:4244/ICommService/BasicHttp"); fileServer.open(); Console.WriteLine("Creating channel to send message to repository..."); msgSenderwithRepo.CreateMessageChannel("http://localhost:8085/ICommService"); Console.WriteLine("Creating channel to send message to TH..."); msgSenderwithTH.CreateMessageChannel("http://localhost:8180/ICommService/BasicHttp"); ((Button)sender).IsEnabled = false; }