void SetDisconnected() { connectionState = connectionStates.notConnected; btnConnection.Label = "Connect"; btnConnection.IsEnabled = true; btnConnection.Icon = new SymbolIcon(Symbol.ZeroBars); btnConnection.Icon.Foreground = new SolidColorBrush(Colors.Red); }
void SetConnecting() { connectionState = connectionStates.connecting; btnConnection.Label = "Connecting"; btnConnection.IsEnabled = false; btnConnection.Icon = new SymbolIcon(Symbol.Refresh); btnConnection.Icon.Foreground = new SolidColorBrush(Colors.DodgerBlue); }
void SetConnected() { connectionState = connectionStates.connected; btnConnection.Label = "Disconnect"; btnConnection.IsEnabled = true; btnConnection.Icon = new SymbolIcon(Symbol.FourBars); btnConnection.Icon.Foreground = new SolidColorBrush(Colors.LimeGreen); }
async private void ConnectButton_Click(object sender, RoutedEventArgs e) { if (connectionState == connectionStates.notConnected) { ConnectButton.Content = "Connecting..."; connectionState = connectionStates.connecting; string serverUri = GetServerUri(); RegisterNetworkChangeTask(); // Finally, initiate the connection and set up transport // to be RTC capable. But do this heavy lifting outside of the UI thread. bool result = await Task <bool> .Factory.StartNew(() => { return(commModule.SetupTransport(serverUri)); }); Diag.DebugPrint("CommModule setup result: " + result); if (result == true) { ConnectButton.Content = "Disconnect"; connectionState = connectionStates.connected; } else { ConnectButton.Content = "failed to connect. click to retry"; connectionState = connectionStates.notConnected; } } else if (connectionState == connectionStates.connected) { await Task.Factory.StartNew(() => { commModule.Reset(); }); connectionState = connectionStates.notConnected; ConnectButton.Content = "Connect"; } }
async private void ConnectButton_Click(object sender, RoutedEventArgs e) { if (connectionState == connectionStates.notConnected) { ConnectButton.Content = "Connecting..."; connectionState = connectionStates.connecting; string serverUri = GetServerUri(); RegisterNetworkChangeTask(); // Finally, initiate the connection and set up transport // to be RTC capable. But do this heavy lifting outside of the UI thread. bool result = await Task<bool>.Factory.StartNew(() => { return commModule.SetupTransport(serverUri); }); Diag.DebugPrint("CommModule setup result: " + result); if (result == true) { ConnectButton.Content = "Disconnect"; connectionState = connectionStates.connected; } else { ConnectButton.Content = "failed to connect. click to retry"; connectionState = connectionStates.notConnected; } } else if (connectionState == connectionStates.connected) { await Task.Factory.StartNew(() => { commModule.Reset(); }); connectionState = connectionStates.notConnected; ConnectButton.Content = "Connect"; } }