private void Beta_GetJSON() { string json = string.Empty; var url = GithubAPI.BETA_URL; var httpRequest = (HttpWebRequest)WebRequest.Create(url); httpRequest.Headers["Authorization"] = "Bearer " + GithubAPI.ACCESS_TOKEN; httpRequest.UserAgent = @"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.106 Safari/537.36"; var httpResponse = (HttpWebResponse)httpRequest.GetResponse(); using (var streamReader = new StreamReader(httpResponse.GetResponseStream())) json = streamReader.ReadToEnd(); System.Diagnostics.Debug.WriteLine(httpResponse.StatusCode); BetaNotes.AddRange(JsonConvert.DeserializeObject <List <UpdateNote> >(json)); if (BetaNotes.Count != 0) { var note = BetaNotes[0]; this.Beta_LatestTag = note.tag_name; this.Beta_LatestTagBody = note.body; } }
public async Task <bool> CheckForUpdatesAsync() { System.Diagnostics.Debug.WriteLine("Checking for updates"); try { ReleaseNotes.Clear(); BetaNotes.Clear(); await Task.Run(Beta_GetJSON); await Task.Run(Release_GetJSON); CompareUpdate(); return(true); } catch (Exception err) { System.Diagnostics.Debug.WriteLine("Check for updates failed\nError:" + err.Message); return(false); } }