private async void BTN_Conectar_Click(object sender, RoutedEventArgs e) { Window.Current.CoreWindow.PointerCursor = new CoreCursor(CoreCursorType.Wait, 1); WifiCheckerTimer.Stop(); BTN_Conectar.IsEnabled = false; BTN_Desconectar.IsEnabled = false; try { bool isCorrectNetwork = await wiFiAPConnection.IsCorrectNetworkConnected(needVerifySSID : true, needErrorDialog : true); if (isCorrectNetwork != true) { status = await wiFiAPConnection.WifiConnectionStatus(isDisconnected : false, isConnecting : true); updateTexts.StatusTextAndColor(status, TXT_Status); try { await wiFiAPConnection.ConnectToWifi(); } catch { var dialog = new MessageDialog("Check your WiFi network adapter and the Robotic Arm Access Point!", "Error"); await dialog.ShowAsync(); } } status = await wiFiAPConnection.WifiConnectionStatus(isDisconnected : false, isConnecting : false); bool isConnected = await wiFiAPConnection.IsCorrectNetworkConnected(needVerifySSID : true, needErrorDialog : false); await wiFiAPConnection.WifiConnectionStatus(isDisconnected : !isConnected, isConnecting : true); updateTexts.StatusTextAndColor(status, TXT_Status); Window.Current.CoreWindow.PointerCursor = new CoreCursor(CoreCursorType.Arrow, 1); WifiCheckerTimer.Start(); BTN_Conectar.IsEnabled = true; BTN_Desconectar.IsEnabled = true; } catch { status = await wiFiAPConnection.WifiConnectionStatus(isDisconnected : true, isConnecting : false); updateTexts.StatusTextAndColor(status, TXT_Status); var dialog = new MessageDialog("Check your WiFi network adapter!", "Error"); await dialog.ShowAsync(); } }
public void StatusTextAndColor(WiFiAPConnection.Status status, TextBlock statusText) { if (status == WiFiAPConnection.Status.Disconnected) { statusText.Text = "Disconnected"; statusText.Foreground = new SolidColorBrush(Windows.UI.Colors.Red); } else if (status == WiFiAPConnection.Status.Connected) { statusText.Text = "Connected"; statusText.Foreground = new SolidColorBrush(Windows.UI.Colors.Green); } else if (status == WiFiAPConnection.Status.Connecting) { statusText.Text = "Connecting"; statusText.Foreground = new SolidColorBrush(Windows.UI.Colors.DarkOrange); } }
private async void WifiCheckerTimer_Tick(object sender, object e) { status = await wiFiAPConnection.WifiConnectionStatus(isDisconnected : false, isConnecting : false); if (status == WiFiAPConnection.Status.Connected && isPlaying != true && isChangingControls != true) { blocker.BlockControls(locked: false, Blocker1, Blocker2, Blocker3); } else { blocker.BlockControls(locked: true, Blocker1, Blocker2, Blocker3); } if (status != WiFiAPConnection.Status.Connected) { blocker.SetStopButtonZIndexToBlock(isButtonAhead: false, Blocker2, StopPlayback); } QuantidadeItens.Text = Convert.ToString(framesList.Count); }
private async void BTN_Desconectar_Click(object sender, RoutedEventArgs e) { Window.Current.CoreWindow.PointerCursor = new CoreCursor(CoreCursorType.Wait, 1); BTN_Conectar.IsEnabled = false; BTN_Desconectar.IsEnabled = false; bool networkNotNull = await wiFiAPConnection.IsCorrectNetworkConnected(needVerifySSID : false, needErrorDialog : false); if (networkNotNull == true) { wiFiAPConnection.DisconnectWifi(); status = await wiFiAPConnection.WifiConnectionStatus(isDisconnected : true, isConnecting : false); updateTexts.StatusTextAndColor(status, TXT_Status); } else { status = await wiFiAPConnection.WifiConnectionStatus(isDisconnected : false, isConnecting : false); updateTexts.StatusTextAndColor(status, TXT_Status); } Window.Current.CoreWindow.PointerCursor = new CoreCursor(CoreCursorType.Arrow, 1); BTN_Conectar.IsEnabled = true; BTN_Desconectar.IsEnabled = true; }
private async void WifiCheckerTimer_Tick(object sender, object e) { status = await wiFiAPConnection.WifiConnectionStatus(isDisconnected : false, isConnecting : false); updateTexts.StatusTextAndColor(status, TXT_Status); }
private async void WifiCheckerTimer_Tick(object sender, object e) //Metodo do Timer para atualizar o Status do Wifi { status = await wiFiAPConnection.WifiConnectionStatus(isDisconnected : false, isConnecting : false); updateTexts.StatusTextAndColor(status, TXT_StatusGlobal); }