private void client_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e) { var bitmap = new BitmapImage(); bitmap.SetSource(e.Result); String tempJPEG = "MyWallpaper1.jpg"; using (IsolatedStorageFile myIsolatedStorage = IsolatedStorageFile.GetUserStoreForApplication()) { if (myIsolatedStorage.FileExists(tempJPEG)) { myIsolatedStorage.DeleteFile(tempJPEG); } var fileStream = myIsolatedStorage.CreateFile(tempJPEG); var uri = new Uri(tempJPEG, UriKind.Relative); Application.GetResourceStream(uri); var wb = new WriteableBitmap(bitmap); wb.SaveJpeg(fileStream, wb.PixelWidth, wb.PixelHeight, 0, 90); fileStream.Close(); } LockScreenChange(tempJPEG); }
private void Client_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e) { if (e.Error == null) { DataContractJsonSerializer serializer = new DataContractJsonSerializer(typeof(List<JogoPerfilUsuario>)); List<JogoPerfilUsuario> jogos = (List<JogoPerfilUsuario>)serializer.ReadObject(e.Result); if(jogos.Count == 0) { CarregarJogos(); } else { configurado = true; List<Jogo> lista = new List<Jogo>(); foreach (var item in jogos) { Jogo jogo = new Jogo(); jogo.Console = item.Console; jogo.Descricao = item.Descricao; jogo.Foto = item.Foto; jogo.Id = item.JogoId; lista.Add(jogo); } lbJogos.ItemsSource = lista; } } }
private void OnEmployeeServiceOpenReadComplete(object sender, OpenReadCompletedEventArgs e) { var reader = new StreamReader(e.Result); var result = reader.ReadToEnd(); XmlReader XMLReader = XmlReader.Create(new MemoryStream(System.Text.UnicodeEncoding.Unicode.GetBytes(result))); XDocument data = XDocument.Load(XMLReader); var query = from emp in data.Elements("employee") select new Colleague { ColleagueID = emp.Element("guid").Value, FirstName = emp.Element("firstname").Value, LastName = emp.Element("lastname").Value, Title = emp.Element("title").Value, CurrentLocation = emp.Element("currentlocation").Value, PhotoURL = string.Format("http://{0}",emp.Element("photourl").Value), ThumbnailURL = string.Format("http://{0}",emp.Element("thumbnailurl").Value), MobilePhone = emp.Element("mobilephonenumber").Value }; colleague = query.SingleOrDefault(); this.txtIntro.Visibility = Visibility.Collapsed; this.DataContext = colleague; this.ThumbnailStoryboard.Begin(); }
void client_OpenReadCompleted(object sender, System.Net.OpenReadCompletedEventArgs e) { try { System.Diagnostics.Debug.WriteLine("1: " + Microsoft.Phone.Info.DeviceExtendedProperties.GetValue("ApplicationCurrentMemoryUsage")); using (var store = IsolatedStorageFile.GetUserStoreForApplication()) { using (var stream = new IsolatedStorageFileStream("mybg.jpg", FileMode.OpenOrCreate, store)) { e.Result.CopyTo(stream); } } System.Diagnostics.Debug.WriteLine("1: " + Microsoft.Phone.Info.DeviceExtendedProperties.GetValue("ApplicationCurrentMemoryUsage")); e = null; sender = null; GC.Collect(); } catch (Exception ex) { msgbox("Exception in bing saver: " + ex.Message); } bingUpdateStatePending = false; }
void client_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e) { byte[] buffer = new byte[1024]; e.Result.Read(buffer, 0, buffer.Length); string s = Encoding.UTF8.GetString(buffer, 0, buffer.Length); }
void wc_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e) { Stream stream = e.Result; var reader = new StreamReader(stream); var shortenedUrl = reader.ReadToEnd(); _callback(shortenedUrl); }
void webc_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e) { if (e.Error == null) { try { XDocument doc = XDocument.Load(e.Result); var items = from item in doc.Descendants("item") select new { Title = item.Element("title").Value, Link = item.Element("link").Value, }; foreach (var item in items) { this.strikeList.Add(new StrikeRecord(item.Title, item.Link)); cache.Marshall(this.strikeList); } } catch (Exception ex) { MessageBox.Show("Παρουσιάστηκε σφάλμα κατα την ανάκτηση των δεδομένων"); this.strikeList = cache.Unmarshall(); } } else { attnNotifier(); this.strikeList = cache.Unmarshall(); } dataNotifier(); }
private void ClientOpenReadCompleted(object sender, OpenReadCompletedEventArgs e) { if (e.Error != null) { var ex = e.Error; System.Diagnostics.Debug.WriteLine(ex.Message); System.Diagnostics.Debug.WriteLine(ex.StackTrace); while(ex.InnerException != null) { ex = ex.InnerException; System.Diagnostics.Debug.WriteLine(ex.Message); System.Diagnostics.Debug.WriteLine(ex.StackTrace); } if (e.Error.InnerException != null) throw e.Error.InnerException; throw e.Error; } this.Stream = e.Result; if (this.OnPreLoaded != null) { PreLoadingItemCompleteEventArgs args = new PreLoadingItemCompleteEventArgs { Item = this }; this.OnPreLoaded(this, args); } }
private void webClient_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e) { if (e == null || e.Cancelled) return; if (e.Error != null) { OnBackgroundOpenReadAsyncFailed(new ExceptionEventArgs(e.Error, e.UserState)); return; } // Convert stream contents to a string. This processing must be done here, on the background thread, in order to succeed. // Once this is done, however, all remaining logic should be executed on the main thread as the original invocation of this // function has logic that requires that it run on the main thread (updating UI elements, etc.). string temp = ""; using (var reader = new StreamReader(e.Result)) { temp = reader.ReadToEnd(); } if (string.IsNullOrEmpty(temp)) { OnBackgroundOpenReadAsyncFailed(new ExceptionEventArgs(new Exception("Empty response!"), e.UserState)); return; } OnBackgroundOpenReadAsyncCompleted(new BackgroundOpenReadAsyncEventArgs() { OrcEventArgs = e, Json = temp, UserToken = e.UserState }); }
static void wc_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e) { if (e.Error == null) { StreamResourceInfo zipInfo = new StreamResourceInfo(e.Result, null); // Read manifest from zip file StreamResourceInfo manifestInfo = Application.GetResourceStream(_zipInfo, new Uri("content.xml", UriKind.Relative)); StreamReader reader = new StreamReader(manifestInfo.Stream); XDocument document = XDocument.Load(reader); var mediaFiles = from m in document.Descendants("mediafile") select new MediaInfo { Type = (MediaType) Enum.Parse(typeof(MediaType), m.Attribute("type").Value, true), Name = m.Attribute("name").Value }; _mediaInfos = new List<MediaInfo>(); _mediaInfos.AddRange(mediaFiles); ProgressTextBlock.Visibility = Visibility.Collapsed; PrevButton.IsEnabled = true; NextButton.IsEnabled = true; DisplayMedia(_mediaInfos[0]); StreamResourceInfo manifestInfo = Application.GetResourceStream(zipInfo, new Uri("content.xml", UriKind.Relative)); StreamReader reader = new StreamReader(manifestInfo.Stream); XDocument xd = XDocument.Load(reader); reader.Close(); var files = from m in xd.Descendants("templatefile") select m.Attribute("name").Value; if (DataTemplates == null) DataTemplates = new Dictionary<string, string>(); foreach (var f in files) { string filename = f + ".xaml"; StreamResourceInfo streamInfo = Application.GetResourceStream(zipInfo, new Uri(filename, UriKind.Relative)); using (StreamReader r = new StreamReader(streamInfo.Stream)) { string s = r.ReadToEnd(); if (!DataTemplates.ContainsKey(f)) DataTemplates.Add(f, s); } } } }
void clientCities_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e) { //MessageBox.Show(e.Result.); var serializer = new DataContractJsonSerializer(typeof(Cities)); Cities ipResult = (Cities)serializer.ReadObject(e.Result); List<AtrractionsList> citiesList = new List<AtrractionsList>(); for (int i = 0; i <= ipResult.addresses.Length - 1; i++) { Random k = new Random(); Double value = 0; String DefaultTitle = "Title"; String DefaultDescription = "Description"; String RandomType = ""; value = k.NextDouble(); DefaultTitle = ipResult.addresses[i].Name.ToString(); DefaultDescription = ipResult.addresses[i].ID.ToString(); RandomType = "Place" ; citiesList.Add(new AtrractionsList(DefaultTitle, DefaultDescription, RandomType)); } listBoxCities.ItemsSource = citiesList; listBoxAttractions.ItemsSource = citiesList; }
private void LineWebClient_Completed(object sender, OpenReadCompletedEventArgs e) { try { using (StreamReader reader = new StreamReader(e.Result)) { string contents = reader.ReadToEnd(); ObservableCollection<Line> lines = XMLUtils.parseXMLForLine(contents); if (lines.Count == 0) { MessageBox.Show("无此线路"); } else { llsLines.ItemsSource = lines; } } } catch { MessageBox.Show("数据获取失败,请检查您的网络!", "错误", MessageBoxButton.OK); } finally { pgbLine.Visibility = Visibility.Collapsed; btnSearchForLine.IsEnabled = true; } }
void produto_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e) { if(e.Error==null) { Stream stream = e.Result; XDocument xml = XDocument.Load(stream, LoadOptions.SetBaseUri); List<XElement> _produtos = xml.Descendants("produtos").ToList(); foreach (XElement item in _produtos) { this.listaProduto.Add(new Entidade.produto() { desc = item.Element("descricao").Value, quant = Convert.ToInt32(item.Element("quantidade").Value) }); } this.listaProdutos.ItemsSource = listaProduto; } else { MessageBox.Show("Erro na aplicação", "ERRO!", MessageBoxButton.OK); } }
void client_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e) { if (e.Error != null) return; Stream str = e.Result; try { String eve = "item"; XDocument loadedData = XDocument.Load(str); foreach (var x in loadedData.Descendants(eve)) { try { item c = new item(); c.title = x.Element("title").Value; c.link = x.Element("link").Value; c.description = x.Element("description").Value; c.pubDate = x.Element("pubDate").Value; Items.Add(c); } catch (Exception ex) { } } list.ItemsSource = Items; } catch (System.Xml.XmlException ex) { MessageBox.Show("Bağlantı Hatası!\nLütfen Tekrar Deneyin."); } }
private void wc_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e) { var manifestStream = Application.GetResourceStream( new StreamResourceInfo(e.Result, null), new Uri("AppManifest.xaml", UriKind.Relative)); string appManifest = new StreamReader(manifestStream.Stream).ReadToEnd(); XmlReader reader = XmlReader.Create(new StringReader(appManifest)); while (reader.Read()) { if (reader.IsStartElement("AssemblyPart")) { reader.MoveToAttribute("Source"); reader.ReadAttributeValue(); if (reader.Value.StartsWith("NIS.Module.") && !reader.Value.Contains("Interfaces") && !reader.Value.Contains("Services"))//&& reader.Value != assemblyName && GetMainAssembly==null { var assemblyStream = new StreamResourceInfo(e.Result, "application/binary"); var si = Application.GetResourceStream(assemblyStream, new Uri(reader.Value, UriKind.Relative)); GetMainAssembly(new AssemblyPart().Load(si.Stream)); _countModulesToLoad++; if(_countModulesToLoad==_overalModuleCount) { LoadCompleted(null, null); } } } } }
private void OnLogoutCompleted(object sender, OpenReadCompletedEventArgs e) { if (this.LogoutCompleted != null) { this.LogoutCompleted(sender, new EventArgs()); } }
void wc_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e) { try { if (e.Result != null) { Stream x = e.Result; byte[] baX; byte[] buffer = new byte[16 * 1024]; using (MemoryStream ms = new MemoryStream()) { int read; while ((read = x.Read(buffer, 0, buffer.Length)) > 0) { ms.Write(buffer, 0, read); } baX = ms.ToArray(); } // baX = Encoding.Convert(Encoding.GetEncoding("iso-8859-1"), Encoding.UTF8, baX); string jsonString = Encoding.UTF8.GetString(baX, 0, baX.Length); ////////Newtonsoft.Json.Linq.JObject oJson = Newtonsoft.Json.Linq.JObject.Parse(jsonString); ////////JsonSerializer ser = new JsonSerializer(); ////////Plus p = (Plus)ser.Deserialize(new Newtonsoft.Json.Linq.JTokenReader(oJson), typeof(Plus)); ////////lblDigit1.Content = p.value1; ////////lblDigit2.Content = p.value2; ////////lblOperator.Content = p.operand; ////////lblAnswer.Content = p.result; } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void WebClientOnOpenReadCompleted(object sender, OpenReadCompletedEventArgs e) { var asyncContext = (AsyncContext)e.UserState; try { if (e.Error != null) { var webException = e.Error as WebException; if (webException != null) { if (webException.Status == WebExceptionStatus.RequestCanceled) { asyncContext.Error = new RestartException(e.Error.Message, e.Error); return; } } asyncContext.Error = e.Error; return; } Stream stream = e.Result; if (asyncContext.IsZip) stream = UnZip(stream); stream.CopyTo(asyncContext.Stream); } catch (Exception ex) { asyncContext.Error = ex; } finally { asyncContext.WaitHandle.Set(); } }
void downloader_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e) { try { m_XapIsLoaded = true; ItemsComboBox.Items.Clear(); ItemsComboBox.Items.Add(new NoneItemControl()); string appManifest = new StreamReader(Application.GetResourceStream(new StreamResourceInfo(e.Result, null), new Uri("AppManifest.xaml", UriKind.Relative)).Stream).ReadToEnd(); XElement deploymentRoot = XDocument.Parse(appManifest).Root; List<XElement> deploymentParts = (from assemblyParts in deploymentRoot.Elements().Elements() select assemblyParts).ToList(); foreach (XElement xElement in deploymentParts) { string source = xElement.Attribute("Source").Value; AssemblyPart asmPart = new AssemblyPart(); StreamResourceInfo streamInfo = Application.GetResourceStream(new StreamResourceInfo(e.Result, "application/binary"), new Uri(source, UriKind.Relative)); var asm = asmPart.Load(streamInfo.Stream); if (asm != null && asm.ManifestModule != null) { ItemsComboBox.Items.Add(new ItemControlBase(false) { Text = asm.ManifestModule.ToString(), Tag = asm }); } } if (ItemsComboBox.Items.Count > 0) { ItemsComboBox.SelectedIndex = 0; } } catch { } }
private void WebClient_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e) { if(DownloadComplete != null) { DownloadComplete(this, new DownloadCompleteEventArgs(e.Result, e.Error, e.Cancelled, e.UserState)); } }
void webClient_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e) { DataContractJsonSerializer ser = null; try { ser = new DataContractJsonSerializer(typeof(ObservableCollection<RootObject>)); ObservableCollection<RootObject> employees = ser.ReadObject(e.Result) as ObservableCollection<RootObject>; foreach (RootObject em in employees) { string id = em.name; //string nm = em.GetRoot.Customer.CustomerID; lstEmployee.Items.Add("<" + id + ">"); foreach (var error in em.items) { lstEmployee.Items.Add(">>" + error.name + " (State: " + error.state + " )"); } lstEmployee.Items.Add(" "); } } catch (Exception ex) { MessageBox.Show(ex.Message + "error came here 2" + ex.StackTrace); } }
void client_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e) { if (e.Error != null) return; Stream str = e.Result; try { String eve = "author"; XDocument loadedData = XDocument.Load(str); foreach (var item in loadedData.Descendants(eve)) { try { Author c = new Author(); c.name = item.Element("name").Value; c.count = Convert.ToInt32(item.Element("count").Value); c.likes = Convert.ToInt32(item.Element("voting").Value); authors.Add(c); } catch (Exception ex) { //GoogleAnalytics.EasyTracker.GetTracker().SendException(ex.Message, false); } } authorlistbox.ItemsSource = authors; } catch (System.Xml.XmlException ex) { MessageBox.Show("limited connectivity or invalid data.\nplease try again"); } }
void m_downloadClient_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e) { if (DownloadCompleted != null) { DownloadCompleted(e.Result); } }
void client_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e) { //MessageBox.Show(e.Result.); var serializer = new DataContractJsonSerializer(typeof(UserList)); UserList ipResult = (UserList)serializer.ReadObject(e.Result); List<AtrractionsList> userLists = new List<AtrractionsList>(); for (int i = 0; i <= ipResult.lists.Length - 1; i++) { Random k = new Random(); Double value = 0; String DefaultTitle = "Title"; String DefaultDescription = "Description"; String RandomType = ""; value = k.NextDouble(); DefaultTitle = ipResult.lists[i].Name.ToString(); DefaultDescription = ipResult.lists[i].ID.ToString(); RandomType = "Place"; userLists.Add(new AtrractionsList(DefaultTitle, DefaultDescription, RandomType)); } lbUserAttractions.ItemsSource = userLists; }
private void client_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e) { List<Cidade> cidades = new List<Cidade>(); Stream str = e.Result; XDocument loadedData = XDocument.Load(str); try { try { String eve = "city"; foreach (var item in loadedData.Descendants(eve)) { Cidade c = new Cidade(); c.name = item.Element("name").Value; c.xml_url = item.Element("info").Value; cidades.Add(c); } LstItem.ItemsSource = cidades; txtBCidade.Text = "Digite a cidade:"; } catch (Exception ex) { txtBCidade.Text = "Erro no xml."; } } catch (Exception ex) { txtBCidade.Text = "Digite a cidade:"; MessageBox.Show("Não foi possível procurar as cidades."); } }
void webClient_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e) { try { if (e.Result != null) { #region Isolated Storage Copy Code isolatedStorageFile = IsolatedStorageFile.GetUserStoreForApplication(); bool checkQuotaIncrease = IncreaseIsolatedStorageSpace(e.Result.Length); string VideoFile = "PlayFile.mp4"; isolatedStorageFileStream = new IsolatedStorageFileStream(VideoFile, FileMode.Create, isolatedStorageFile); long VideoFileLength = (long)e.Result.Length; byte[] byteImage = new byte[VideoFileLength]; e.Result.Read(byteImage, 0, byteImage.Length); isolatedStorageFileStream.Write(byteImage, 0, byteImage.Length); #endregion mediaFile.SetSource(isolatedStorageFileStream); mediaFile.Play(); progressMedia.Visibility = Visibility.Collapsed; } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void callbackMethod(object sender, OpenReadCompletedEventArgs e) { bool thisMayBeTheCorrectLyric = true; StringBuilder lyricTemp = new StringBuilder(); WebClient client = (WebClient)sender; Stream reply = null; StreamReader sr = null; try { reply = (Stream)e.Result; sr = new StreamReader(reply); string line = ""; int noOfLinesCount = 0; while (line.IndexOf("</style>") == -1) { if (sr.EndOfStream || ++noOfLinesCount > 300) { thisMayBeTheCorrectLyric = false; break; } else { line = sr.ReadLine(); } } if (thisMayBeTheCorrectLyric) { line = sr.ReadLine(); lyric = line.Replace("<br>", "\r\n").Trim(); // if warning message from Evil Labs' sql-server, then lyric isn't found if (lyric.Contains("<b>Warning</b>") || lyric.Contains("type=")) { lyric = "Not found"; } } } catch (System.Reflection.TargetInvocationException) { lyric = "Not found"; } finally { if (sr != null) { sr.Close(); } if (reply != null) { reply.Close(); } complete = true; } }
void webc_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e) { HtmlDocument doc = new HtmlDocument(); bool errorExist = false; if (e.Error == null) { // Complete try { doc.Load(e.Result); var items = from item in doc.DocumentNode.Descendants("li") select new { Title = item.InnerText }; foreach (var item in items) { this.strikeList.Add(new StrikeRecord(HttpUtility.HtmlDecode(HttpUtility.HtmlDecode(item.Title)), "")); } } catch (Exception ex) { errorExist = true; } } else { errorExist = true; } dataNotifier(errorExist); }
void WebClientOpenReadCompleted(object sender, OpenReadCompletedEventArgs e) { const string tempJpeg = "TempJPEG"; var streamResourceInfo = new StreamResourceInfo(e.Result, null); var userStoreForApplication = IsolatedStorageFile.GetUserStoreForApplication(); if (userStoreForApplication.FileExists(tempJpeg)) { userStoreForApplication.DeleteFile(tempJpeg); } var isolatedStorageFileStream = userStoreForApplication.CreateFile(tempJpeg); var bitmapImage = new BitmapImage { CreateOptions = BitmapCreateOptions.None }; bitmapImage.SetSource(streamResourceInfo.Stream); var writeableBitmap = new WriteableBitmap(bitmapImage); writeableBitmap.SaveJpeg(isolatedStorageFileStream, writeableBitmap.PixelWidth, writeableBitmap.PixelHeight, 0, 85); isolatedStorageFileStream.Close(); isolatedStorageFileStream = userStoreForApplication.OpenFile(tempJpeg, FileMode.Open, FileAccess.Read); // Save the image to the camera roll or saved pictures album. var mediaLibrary = new MediaLibrary(); // Save the image to the saved pictures album. mediaLibrary.SavePicture(string.Format("SavedPicture{0}.jpg", DateTime.Now), isolatedStorageFileStream); isolatedStorageFileStream.Close(); }
void webc_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e) { HtmlDocument doc = new HtmlDocument(); if (e.Error == null) { try { doc.Load(e.Result); var items = from item in doc.DocumentNode.Descendants("li") select new { Title = item.InnerText }; foreach (var item in items) { this.strikeList.Add(new StrikeRecord(HttpUtility.HtmlDecode(HttpUtility.HtmlDecode(item.Title)), "")); } cache.Marshall(this.strikeList); } catch (Exception ex) { MessageBox.Show("Παρουσιάστηκε σφάλμα κατα την ανάκτηση των δεδομένων"); this.strikeList = cache.Unmarshall(); } } else { this.strikeList = cache.Unmarshall(); } dataNotifier(); }
void wc_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e) { if (e.Error == null && !e.Cancelled) { string iconPath = "1.txt"; using (var isf = IsolatedStorageFile.GetUserStoreForApplication()) { var isfs = new IsolatedStorageFileStream(iconPath, FileMode.Create, isf); int bytesRead; byte[] bytes = new byte[e.Result.Length]; while ((bytesRead = e.Result.Read(bytes, 0, bytes.Length)) != 0) { isfs.Write(bytes, 0, bytesRead); } isfs.Flush(); isfs.Close(); } this.Dispatcher.BeginInvoke(() => { NavigationService.Navigate(new Uri("/MainPage.xaml", UriKind.Relative)); }); } }
static void client_OpenReadCompleted(object sender, System.Net.OpenReadCompletedEventArgs e) { using (var store = IsolatedStorageFile.GetUserStoreForApplication()) { using (var stream = new IsolatedStorageFileStream("bing.jpg", FileMode.OpenOrCreate, store)) { e.Result.CopyTo(stream); } } updateBackground("bing.jpg"); }
/// <summary> /// Refreshes the Local RSS /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void wc_OpenReadCompleted(object sender, System.Net.OpenReadCompletedEventArgs e) { using (WebClient wc = (System.Net.WebClient)sender) { if (e.Error != null) { Trace.WriteLine(String.Format("[*]ScheduleID:{1},LayoutID:{2},MediaID:{3},Message:{0}", e.Error, _scheduleId, _layoutId, _mediaid)); return; } try { using (StreamReader sr = new StreamReader(e.Result, wc.Encoding)) { using (StreamWriter sw = new StreamWriter(File.Open(_rssFilePath, FileMode.Create, FileAccess.Write, FileShare.Read), wc.Encoding)) { Debug.WriteLine("Retrieved RSS - about to write it", "RSS - wc_OpenReadCompleted"); sw.Write(sr.ReadToEnd()); } _rssReady = true; } } catch (Exception ex) { Trace.WriteLine(String.Format("[*]ScheduleID:{1},LayoutID:{2},MediaID:{3},Message:{0}", ex.Message, _scheduleId, _layoutId, _mediaid)); } } try { if (_rssReady) { LoadRssIntoTempFile(); // Navigate to temp file _webBrowser.Navigate(_tempHtml.Path); } } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.Message); // The control might have expired by the time this returns } }
private void client_OpenReadCompleted(object sender, System.Net.OpenReadCompletedEventArgs e) { host.UI.prsBar.Visibility = System.Windows.Visibility.Collapsed; if (e.Error == null) { qryIco(e.Result); e.Result.Seek(0, System.IO.SeekOrigin.Begin); byte [] ay = new byte [e.Result.Length]; e.Result.Read(ay, 0, (int)e.Result.Length); m_memIco = new System.IO.MemoryStream((int)e.Result.Length); m_memIco.Write(ay, 0, (int)e.Result.Length); m_memIco.Seek(0, System.IO.SeekOrigin.Begin); } else { alert("error!"); } }
protected virtual void OnOpenReadCompleted(OpenReadCompletedEventArgs e) { throw new NotImplementedException(); }
protected virtual new void OnOpenReadCompleted(OpenReadCompletedEventArgs e) { }
private void Webclient_OpenReadCompleted(object sender, System.Net.OpenReadCompletedEventArgs e) { throw new NotImplementedException(); }