Beispiel #1
0
        private static void Start()
        {
            if (_serverBrowser.IsRunning)
            {
                return;
            }

            _serverBrowser.SearchForServices("_touch-able._tcp.local.");
        }
        private void StartServiceBrowser()
        {
            _browser = new NetServiceBrowser();
            _browser.ServiceFound   += _browser_ServiceFound;
            _browser.ServiceRemoved += _browser_ServiceRemoved;
            _browser.SearchForServices("_touch-able._tcp.local.");

            browseStartButton.IsEnabled = false;
            browseStopButton.IsEnabled  = true;
        }
        private void StartServiceBrowser()
        {
            StartBrowseButton.IsEnabled = false;

            _discoveredServices = new ObservableCollectionEx <string>();
            PageViewSource["DiscoveredServices"] = _discoveredServices;

            _browser = new NetServiceBrowser();
            _browser.ServiceFound   += _browser_ServiceFound;
            _browser.ServiceRemoved += _browser_ServiceRemoved;
            _browser.SearchForServices("_touch-able._tcp.local");

            StopBrowseButton.IsEnabled = true;
        }
        public static void SearchForPairingUtility()
        {
            if (_pairingUtilityBrowser != null)
            {
                return;
            }

            _log.Info("Searching for pairing utility...");

            _pairingUtilityBrowser = new NetServiceBrowser();
            HookEvents();

            // Begin searching for services
            if (NetworkManager.IsLocalNetworkAvailable)
            {
                _pairingUtilityBrowser.SearchForServices(PairingUtilityServiceName);
            }
        }
        private static void NetworkManager_NetworkAvailabilityChanged(object sender, NetworkAvailabilityChangedEventArgs e)
        {
            if (_pairingUtilityBrowser == null)
            {
                return;
            }

            if (e.IsLocalNetworkAvailable)
            {
                if (!_pairingUtilityBrowser.IsRunning)
                {
                    _pairingUtilityBrowser.SearchForServices(PairingUtilityServiceName);
                }
            }
            else
            {
                _pairingUtilityBrowser.Stop();
                ThreadUtility.RunOnUIThread(() =>
                {
                    DiscoveredPairingUtilities.Clear();
                });
            }
        }