private void OpenAnnouncementService() { this.announcementService = new AnnouncementService(); // Add event handlers this.announcementService.OnlineAnnouncementReceived += new EventHandler<AnnouncementEventArgs>(this.OnOnlineAnnouncement); this.announcementService.OfflineAnnouncementReceived += new EventHandler<AnnouncementEventArgs>(this.OnOfflineAnnouncement); // Create the service host with a singleton this.announcementServiceHost = new ServiceHost(this.announcementService); // Add the announcement endpoint this.announcementServiceHost.AddServiceEndpoint(new UdpAnnouncementEndpoint()); // Open the host async this.announcementServiceHost.BeginOpen( (result) => { announcementServiceHost.EndOpen(result); }, null); }
FakePre-250f29d98f3449de90cc7efea0f7d68b-dbfb81d8ab2c4382b5944822ca68c231FakePre-4b9f50b38376421c8fdb7a3ab1cf2db2-deb1487b086c4c34b5f383de28b0c7d0FakePre-cf0e30dca7d4493eb2c21993dc377fe5-15e39e9e96de442e866f9f693c3c99f4
Private Sub OpenAnnouncementService() Me.announcementService = New AnnouncementService() ' Add event handlers AddHandler announcementService.OnlineAnnouncementReceived, AddressOf OnOnlineAnnouncement AddHandler announcementService.OfflineAnnouncementReceived, AddressOf OnOfflineAnnouncement ' Create the service host with a singleton Me.announcementServiceHost = New ServiceHost(Me.announcementService) ' Add the announcement endpoint Me.announcementServiceHost.AddServiceEndpoint(New UdpAnnouncementEndpoint()) ' Open the host async Me.announcementServiceHost.BeginOpen(Sub(result) announcementServiceHost.EndOpen(result), Nothing) End Sub
FakePre-f9fa3b3e03ca4f6290d304292dcba43e-d736366fdfe4438ba246744044c3baaaFakePre-c1e3a3b491e7419d80e35f35ee967ef2-8dd3df204d804945b94d4b8ca5b499a9FakePre-527907f4a6924242abac4f2e608454a4-3bef11cc26c648a8be90886b6a343d52