// STEP4 STEP4 STEP4 private string ReadWebRequestCallback(IAsyncResult callbackResult) { try { HttpWebRequest myRequest = (HttpWebRequest)callbackResult.AsyncState; HttpWebResponse myResponse = (HttpWebResponse)myRequest.EndGetResponse(callbackResult); using (StreamReader httpwebStreamReader = new StreamReader(myResponse.GetResponseStream())) { string fil = httpwebStreamReader.ReadToEnd(); FileToSave = fil; if (FileToSave != "") { FileManip f = new FileManip(); XML x = new XML(); list = x.Retrive(fil); if (list.Select(e=>e.Pubdate).Contains(LatestDate)) { } f.Update(Filename, FileToSave); } } myResponse.Close(); } catch (Exception we) { } }
private void ReadWebRequestCallback(IAsyncResult callbackResult) { try { HttpWebRequest myRequest = (HttpWebRequest)callbackResult.AsyncState; HttpWebResponse myResponse = (HttpWebResponse)myRequest.EndGetResponse(callbackResult); using (StreamReader httpwebStreamReader = new StreamReader(myResponse.GetResponseStream())) { string fil = httpwebStreamReader.ReadToEnd(); string FileToSave = fil; EasyPin.XML x = new EasyPin.XML(); list = x.Retrive(fil); FileManip manip = new FileManip(); if (manip.Update(filename, FileToSave) == "Updated") { Dispatcher.BeginInvoke(() => image1.Visibility = Visibility.Collapsed); Dispatcher.BeginInvoke(() => listBox1.ItemsSource = list); Dispatcher.BeginInvoke(() => listBox1.Visibility = Visibility.Visible); } } myResponse.Close(); } catch (Exception s) { Dispatcher.BeginInvoke(() => image1.Visibility = Visibility.Collapsed); Dispatcher.BeginInvoke(() => listBox1.Visibility = Visibility.Visible); } }