/// <summary> /// Query the app list on the server to get the Steam App ID /// </summary> /// <returns>True if the operation succeeded, false otherwise</returns> private static async Task<int> LookupAppIdForApp(CoreDispatcher dispatcher, NvHttp nv, String app) { XmlQuery appList; string appIdStr; appList = new XmlQuery(nv.BaseUrl + "/applist?uniqueid=" + nv.GetUniqueId()); // App list query went well - try to get the app ID try { appIdStr = await appList.SearchElement("App", "AppTitle", app, "ID"); Debug.WriteLine(appIdStr); if (appIdStr == null) { // Not found DialogUtils.DisplayDialog(dispatcher, "App Not Found", "App ID Lookup Failed"); return 0; } } // Exception connecting to the resource catch (Exception e) { // Steam ID lookup failed DialogUtils.DisplayDialog(dispatcher, "Failed to get app ID: " + e.Message, "App ID Lookup Failed"); return 0; } // We're in the clear - save the app ID return Convert.ToInt32(appIdStr); }
/// <summary> /// Query the app list on the server to get the Steam App ID /// </summary> /// <returns>True if the operation succeeded, false otherwise</returns> private static async Task <int> LookupAppIdForApp(CoreDispatcher dispatcher, NvHttp nv, String app) { XmlQuery appList; string appIdStr; appList = new XmlQuery(nv.BaseUrl + "/applist?uniqueid=" + nv.GetUniqueId()); // App list query went well - try to get the app ID try { appIdStr = await appList.SearchElement("App", "AppTitle", app, "ID"); Debug.WriteLine(appIdStr); if (appIdStr == null) { // Not found DialogUtils.DisplayDialog(dispatcher, "App Not Found", "App ID Lookup Failed"); return(0); } } // Exception connecting to the resource catch (Exception e) { // Steam ID lookup failed DialogUtils.DisplayDialog(dispatcher, "Failed to get app ID: " + e.Message, "App ID Lookup Failed"); return(0); } // We're in the clear - save the app ID return(Convert.ToInt32(appIdStr)); }