/// <summary>
 /// Performs a GET REST request using the provided request URI.
 /// </summary>
 /// <param name="requestUri">The request URI to use</param>
 /// <returns>A string of the contents of the response</returns>
 protected async Task <string> GetStringAsync(string requestUri)
 {
     using (AdvancedHttpClient client = await this.GetHttpClient())
     {
         try
         {
             client.RateLimitUpdateOccurred += Client_RateLimitUpdateOccurred;
             return(await client.GetStringAsync(requestUri));
         }
         finally
         {
             client.RateLimitUpdateOccurred -= Client_RateLimitUpdateOccurred;
         }
     }
 }
Example #2
0
        protected override async Task InitializeInternal()
        {
            try
            {
                MixItUpUpdateModel update = await ChannelSession.Services.MixItUpService.GetLatestUpdate();

                if (update != null)
                {
                    using (AdvancedHttpClient client = new AdvancedHttpClient())
                    {
                        string changelogHTML = await client.GetStringAsync(update.ChangelogLink);

                        this.ChangelogWebBrowser.NavigateToString(changelogHTML);
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.Log(ex);
            }
            await base.InitializeInternal();
        }
        protected override async Task OnLoaded()
        {
            this.NewVersionTextBlock.Text     = this.update.Version.ToString();
            this.CurrentVersionTextBlock.Text = Assembly.GetEntryAssembly().GetName().Version.ToString();

            if (this.update.IsPreview)
            {
                this.PreviewUpdateGrid.Visibility = Visibility.Visible;
            }

            try
            {
                using (AdvancedHttpClient client = new AdvancedHttpClient())
                {
                    string changelogHTML = await client.GetStringAsync(this.update.ChangelogLink);

                    this.UpdateChangelogWebBrowser.NavigateToString(changelogHTML);
                }
            }
            catch (Exception ex) { Logger.Log(ex); }

            await base.OnLoaded();
        }