/// <summary> /// When the user presses "Start Streaming Steam", first check that they are paired in the background worker /// </summary> private async Task StreamSetup(string uri) { try { nv = new NvHttp(uri); } catch (Exception) { StreamSetupFailed("Invalid Hostname"); return; } try { await nv.GetServerIPAddress(); } catch (Exception) { StreamSetupFailed("Unable to get streaming machine's IP addresss"); } // If device is already paired, return. if (!await QueryPairState()) { await StreamSetupFailed("Pair state query failed"); return; } // If we haven't cancelled and don't have the steam ID, query app list to get it if (steamId == 0) { // If queryAppList fails, return if (!await Task.Run(() => QueryAppList())) { await StreamSetupFailed("App list query failed"); return; } } await StreamSetupComplete(); }
/// <summary> /// Pair with the hostname in the textbox /// </summary> private async Task Pair(string uri) { Debug.WriteLine("Pairing "); // Create NvHttp object with the user input as the URL try { nv = new NvHttp(uri); } catch (Exception) { var dialog = new MessageDialog("Invalid Hostname", "Pairing Failed"); dialog.ShowAsync(); return; } // Get the server IP address try { await nv.GetServerIPAddress(); } catch (Exception e) { var dialog = new MessageDialog("Error resolving hostname " + e.Message, "Pairing Failed"); dialog.ShowAsync(); return; } if (await QueryPairState()) { Debug.WriteLine("Already paired"); return; } Challenges(nv.GetDeviceName()); // Otherwise, everything was successful var successDialog = new MessageDialog("Pairing successful", "Success"); await successDialog.ShowAsync(); }