private void WebResponseCallback(IAsyncResult result) { JRate jRate; try { HttpWebRequest request = ((HttpWebRequest)result.AsyncState); StreamReader sr = new StreamReader(request.EndGetResponse(result).GetResponseStream()); string data = sr.ReadToEnd(); jRate = JsonConvert.DeserializeObject<JRate>(data); } catch { jRate = new JRate(); } CallbackMethod(jRate); }
private void UpdateProduction2Rate(JRate jRate) { Dispatcher.BeginInvoke(() => { Production2Rate.Text = jRate.Rate.ToString(); if( jRate.Url != null ) Production2Image.Source = new BitmapImage(new Uri(jRate.Url, UriKind.Absolute)); else Production2Image.Source = new BitmapImage(new Uri(@"assets\DeleteRed.png", UriKind.Relative)); UpdateDone(); }); }