Ejemplo n.º 1
0
        private void OnDiscoveryButtonClicked(object sender, EventArgs e)
        {
            discoveryMode = !discoveryMode;
            Button b = sender as Button;

            if (b == null)
            {
                return;
            }
            var discovery = DeviceDiscovery.GetInstance();

            if (discoveryMode)
            {
                //Start mDNS discovery
                b.Text                         = "Stop discovery";
                devicesFoundCount              = 0;
                discovery.ValidDeviceFound    += OnDeviceCreated;
                discoveryResultLabel.IsVisible = true;
                discoveryResultLabel.Text      = "Found no lights yet...";
                discovery.StartDiscovery();
            }
            else
            {
                //Stop mDNS discovery
                discovery.StopDiscovery();
                discovery.ValidDeviceFound -= OnDeviceCreated;
                b.Text = "Discover lights...";
            }
        }
Ejemplo n.º 2
0
 protected override void OnDisappearing()
 {
     //stop discovery if running
     if (discoveryMode)
     {
         var discovery = DeviceDiscovery.GetInstance();
         discovery.StopDiscovery();
         discovery.ValidDeviceFound -= OnDeviceCreated;
     }
 }