private async void _browser_ServiceFound(object sender, NetServiceEventArgs e) { ThreadUtility.RunOnUIThread(() => { _discoveredServices.Add(e.Service.Name); }); await e.Service.ResolveAsync(); }
void _browser_ServiceRemoved(object sender, NetServiceEventArgs e) { ThreadUtility.RunOnUIThread(() => { var nsvm = _services.FirstOrDefault(s => s.Service == e.Service); if (nsvm != null) { _services.Remove(nsvm); } }); }
private static async void ServerBrowser_ServiceFound(object sender, NetServiceEventArgs e) { await e.Service.ResolveAsync().ConfigureAwait(false); _log.Info("Added service '{0}'.", e.Service.FullServiceInstanceName); lock (DiscoveredServers) DiscoveredServers[e.Service.Name] = e.Service; ServiceAdded.Raise(null, e); }
private static void BonjourManager_ServiceRemoved(object sender, NetServiceEventArgs e) { ServerConnectionInfo info = PairedServers.FirstOrDefault(si => si.ServiceID == e.Service.Name); if (info != null) { _log.Info("Bonjour removed service: '{0}' ({1})", info.Name, info.ServiceID); info.IsAvailable = false; } }
private static void Browser_ServiceRemoved(object sender, NetServiceEventArgs e) { ThreadUtility.RunOnUIThread(() => { var utility = DiscoveredPairingUtilities.FirstOrDefault(u => u.Service == e.Service); if (utility != null) { DiscoveredPairingUtilities.Remove(utility); _log.Info("Removed service {0} ({1})", utility.ServiceID, utility.Name); } }); }
private static void ServerBrowser_ServiceRemoved(object sender, NetServiceEventArgs e) { _log.Info("Removed service '{0}'.", e.Service.FullServiceInstanceName); lock (DiscoveredServers) { if (DiscoveredServers.ContainsKey(e.Service.Name)) { DiscoveredServers.Remove(e.Service.Name); } } ServiceRemoved.Raise(null, e); }
void _browser_ServiceFound(object sender, NetServiceEventArgs e) { ThreadUtility.RunOnUIThread(async() => { if (sender != _browser || !_browser.IsRunning) { return; // Don't attempt to resolve the service if we're no longer looking for services (or if this is the wrong browser) } var nsvm = new NetServiceViewModel(e.Service); _services.Add(nsvm); nsvm.Resolved = "Resolving..."; bool resolved = await e.Service.ResolveAsync(); nsvm.Resolved = "Resolved: " + resolved; nsvm.Refresh(); }); }
private static async void Browser_ServiceFound(object sender, NetServiceEventArgs e) { await e.Service.ResolveAsync().ConfigureAwait(false); ThreadUtility.RunOnUIThread(() => { if (DiscoveredPairingUtilities.Any(u => u.Service == e.Service)) { return; } var utility = new DiscoveredPairingUtility(e.Service); DiscoveredPairingUtilities.Add(utility); _log.Info("Added service {0} ({1})", utility.ServiceID, utility.Name); }); }
private static void BonjourManager_ServiceAdded(object sender, NetServiceEventArgs e) { ServerConnectionInfo info = PairedServers.FirstOrDefault(si => si.ServiceID == e.Service.Name); if (info != null) { _log.Info("Bonjour found service: '{0}' ({1})", info.Name, info.ServiceID); info.IsAvailable = true; UpdateServerInfoFromBonjour(info); // Connect to the server if necessary if (SelectedServerInfo == info) { AutoConnect(); } } }
private void _browser_ServiceRemoved(object sender, NetServiceEventArgs e) { _discoveredServices.Remove(e.Service.Name); }