static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); PeerServiceHost.StartPeerServer(); Application.Run(new Main()); }
private void Run() { Console.WriteLine("Hello! Enter Your Username:"); string username = Console.ReadLine(); Peer <IPingService> peer = new Peer <IPingService> { PeerID = Guid.NewGuid().ToString().Split('-')[4], Username = username }; IPeerRegistrationRepository peerRegistration = new PeerRegistrationManager(); IPeerNameResolverRepository peerNameResolver = new PeerNameResolver(peer.PeerID); IPeerConfigurationService <PingService> peerConfigurationService = new PeerConfigurationService(peer); PeerServiceHost psh = new PeerServiceHost(peerRegistration, peerNameResolver, peerConfigurationService); Thread thd = new Thread(() => { psh.RunPeerServiceHost(peer); }) { IsBackground = true }; thd.Start(); Console.ReadLine(); }