Example #1
0
        // 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)
            {

            }
        }
Example #2
0
 // STEP4 STEP4 STEP4
 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();
             FileToSave = fil;
             XML x = new XML();
             list = x.Retrive(fil);
             Dispatcher.BeginInvoke(() => listBox1.ItemsSource = list);
             Dispatcher.BeginInvoke(() => image1.Visibility = Visibility.Collapsed);
             Dispatcher.BeginInvoke(() => listBox1.Visibility = Visibility.Visible);
             if (list == null)
             {
                 Dispatcher.BeginInvoke(() => MessageBox.Show("No items in this link......:("));
             }
         }
         myResponse.Close();
     }
     catch (Exception we)
     {
         Dispatcher.BeginInvoke(() => image1.Visibility = Visibility.Collapsed);
         Dispatcher.BeginInvoke(() => listBox1.Visibility = Visibility.Visible);
         Dispatcher.BeginInvoke(() => MessageBox.Show("No items in this link......:("));
     }
 }