Ejemplo n.º 1
0
        public async void Search(string HostIDOne, string HostIDTwo, string NetworkIDOne, string NetworkIDTwo, int timeout, int start, int end)
        {
            var approximateNetwork = DataConversion.GetHttpStringFromStrings(HostIDOne, HostIDTwo, NetworkIDOne, NetworkIDTwo);

            try
            {
                Uri approximateNetworkUri = new Uri(approximateNetwork);
                if (approximateNetwork != null)
                {
                    WebServerCentralManager.SetApproximateNetwork(approximateNetworkUri);
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
            }

            var deviceState = WebServerCentralManager.GetDeviceState();

            if (deviceState.State == States.On)
            {
                WebServerCentralManager.Search(start, end, timeout);
            }
            else
            {
                DialogBoxYesOrNo dialogButton = new DialogBoxYesOrNo();
                var result = await dialogButton.ShowDialogBox("It doesn't look like WiFi is on. Go to settings?");

                if (result)
                {
                    bool settingsResult = await Windows.System.Launcher.LaunchUriAsync(new Uri("ms-settings:network-wifi"));
                }
            }
        }
Ejemplo n.º 2
0
            public async Task Search_FindsWebServer_ValidIp()
            {
                var localNetwork = Lumi4IntegrationTestSettings.LocalIP;
                WebServerCentralManager wifiCentralManager = new WebServerCentralManager(localNetwork);
                bool foundDevice = false;

                wifiCentralManager.DiscoveredDevice += delegate(object obj, DiscoveredDeviceEventArgs args)
                {
                    if (args.DiscoveredPeripheral != null)
                    {
                        foundDevice = true;
                    }
                };
                wifiCentralManager.Search(90, 120);
                await Task.Delay(Lumi4IntegrationTestSettings.SearchWifiCallbackDelay);

                Assert.IsTrue(foundDevice);
            }