private void FindCompleted(object sender, FindCompletedEventArgs e) { if (!e.Cancelled) { Start(); } }
void DiscoveryClient_FindCompleted(object sender, FindCompletedEventArgs e) { Console.WriteLine("Search completed ({0} results)", e.Result.Endpoints.Count); _discoveryClient.FindProgressChanged -= DiscoveryClient_FindProgressChanged; _discoveryClient.FindCompleted -= DiscoveryClient_FindCompleted; btnProbe.Enabled = true; }
private static void DiscoveryClientOnFindCompleted(object sender, FindCompletedEventArgs findCompletedEventArgs) { var disposable = sender as IDisposable; if (disposable != null) { disposable.Dispose(); } }
void ApprovalFindCompleted(object sender, FindCompletedEventArgs e) { // If we didn't find any endpoints -- the discovery failed if (e.Result.Endpoints.Count > 0) { approvalAddr = e.Result.Endpoints[0].Address; DiscoveredCommonOps(); } else { statusWriter.WriteLine("Discovery Failed"); } }
private static void DiscoveryClient_FindCompleted(object sender, FindCompletedEventArgs e) { Console.WriteLine("Find finished"); if (e.Result.Endpoints.Count > 0) { discoveredService = e.Result.Endpoints[0]; CallService(); } else { Console.WriteLine("Service not found"); } Console.WriteLine("Now the client really finished"); Console.ReadLine(); }
private void OnServiceFound(object sender, FindCompletedEventArgs e) { var endpoints = new List <EndpointDiscoveryMetadata>(e.Result.Endpoints); var hostName = Environment.MachineName.ToLower(); var hostIndex = endpoints.FindIndex(p => p.Address.Uri.ToString().Contains(hostName)); if (hostIndex != -1) { var wHostEndpoint = endpoints[hostIndex]; endpoints.RemoveAt(hostIndex); endpoints.Insert(0, wHostEndpoint); } foreach (var endpointDiscoveryMetadata in endpoints) { OnServiceOnlineAnnouncementReceived(endpointDiscoveryMetadata); } }
//private void DoWork() //{ // var randomizer = new Random(DateTime.Now.Millisecond); // //while (_keepRunningWorkerThread) // //{ // // Thread.Sleep(2000); // //} //} internal void DiscoveryCompleted(object sender, FindCompletedEventArgs e) { var newKnownDevices = _discoveryService.GetDevices(); Console.WriteLine($"{_moduleName}: Discovered completed, {newKnownDevices.Count} found."); if (_currentKnownDevices == null) { AnnounceNewDevices(newKnownDevices); } else { CompareDevices(newKnownDevices); } _currentKnownDevices = newKnownDevices; _discoveryService = new DiscoveryService(); _discoveryService.Discover(_discoveryTimeOutMiliseconds, DiscoveryCompleted); }
static private void DiscoveryClient_FindCompleted(object sender, FindCompletedEventArgs e) { Console.WriteLine("DiscoveryClient_FindCompleted(...)"); if (e.Error != null) { Console.WriteLine(e.Error); return; } if (!e.Cancelled) { var result = e.Result; if (result != null) { foreach (var ep in result.Endpoints) { string address = ep.Address.ToString(); string hostName = address; var extensions = ep.Extensions; if (extensions != null && extensions.Count > 0) { var hostElement = extensions.FirstOrDefault(el => el.Name == "HostName"); if (hostElement != null) { hostName = hostElement.Value; // + " {" + address + "}"; } } Console.WriteLine(hostName + " " + address); } } } else { Console.WriteLine("ScreenCastControl::FindCompleted(...) Cancelled"); } }
private void OnFindCompleted(object sender, FindCompletedEventArgs e) { if (e.Cancelled) { // 搜索被取消了 } else if (e.Error != null) { // 搜索过程出现错误 this.discoveryClient.Close(); ExceptionHandler.Handle(e.Error); } else { if (this.discoveryClient.InnerChannel.State == CommunicationState.Opened) { this.discoveryClient.Close(); } } this.discoveryClient = null; }
void FindCompleted(object sender, FindCompletedEventArgs e) { if (e.Error != null) { throw e.Error; } try { // Ensures that all FindProgressedChanged events are raised before completing the // AsyncResult. If there are pending FindProgressedChanged events to be raised, then // the AsyncResult will be completed in the FindProgressedChanged method after all // events are raised. if (Interlocked.Add(ref pendingEndpointCount, -e.Result.Endpoints.Count) == 0) { this.Complete(false); } } catch (Exception exception) { this.Complete(false, exception); } }
//searching for addresses finished private static void DiscoveryClient_FindCompleted(object sender, FindCompletedEventArgs e) { var logger = NLog.LogManager.GetCurrentClassLogger(); //create list of founded endpoints List <Uri> endpointsList = new List <Uri>(); try { foreach (var item in e.Result.Endpoints) { Uri endpoint = new Uri(item.Address.ToString()); endpointsList.Add(endpoint); } } catch (Exception ex) { logger.Error($"Error while completing search for host endpoints: {ex.Message}. Inner exception: {ex.InnerException}. Stack trace: {ex.StackTrace}."); } logger.Info("Searching Host endpoints finished. Endpoints founded: " + endpointsList.Count.ToString()); OnSearchingForEndpointsFinished(endpointsList); }
static void discoveryClient_FindCompleted(object sender, FindCompletedEventArgs e) { Console.WriteLine("--------------- Search finished ---------------"); }
private void DiscoveryClientOnFindCompleted(object sender, FindCompletedEventArgs findCompletedEventArgs) { Logger.Debug("Service discovery completed. Found {0} endpoints", findCompletedEventArgs.Result.Endpoints.Count); _isRunning = false; }
private void DiscoveryClient_FindCompleted(object sender, FindCompletedEventArgs e) { this.OnRecoveryChange("", DiscoveryEvent.EventTypes.endEvent); }
static void ClientFindCompleted(object sender, FindCompletedEventArgs e) { // Implement this method to access the FindResponse object through e.Result, which includes all the endpoints found }
private void DiscoveryClient_FindCompleted(object sender, FindCompletedEventArgs e) { tracer.TraceEvent(TraceEventType.Verbose, 0, "ScreenCastControl::FindCompleted(...)"); // logger.Debug("FindCompleted(...)"); finding = false; List <ComboBoxItem> hostItems = new List <ComboBoxItem>(); if (e.Cancelled) { //logger.Debug("Cancelled"); tracer.Verb("ScreenCastControl::FindCompleted(...) Cancelled"); } if (e.Error != null) { // logger.Debug(e.Error.ToString()); tracer.Error(e.Error); } if (!e.Cancelled) { var result = e.Result; if (result != null) { foreach (var ep in result.Endpoints) { string address = ep.Address.ToString(); string hostName = address; var extensions = ep.Extensions; if (extensions != null && extensions.Count > 0) { var hostElement = extensions.FirstOrDefault(el => el.Name == "HostName"); if (hostElement != null) { hostName = hostElement.Value;// + " {" + address + "}"; } } //logger.Debug(hostName); hostItems.Add(new ComboBoxItem { Name = hostName, Tag = address, }); } } } hostsComboBox.DataSource = hostItems; hostsComboBox.DisplayMember = "Name"; discoveryClient.Close(); discoveryClient = null; connectButton.Enabled = true; hostsComboBox.Enabled = true; findServiceButton.Text = "_Find"; labelStatus.Text = "_Not Connected"; }
protected void WsBrowserFindCompleted(object sender, FindCompletedEventArgs e) { OnDiscoveryFinished(new DiscoveryEventArgs()); }