• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Net.OpenReadCompletedEventArgs类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中System.Net.OpenReadCompletedEventArgs的典型用法代码示例。如果您正苦于以下问题:C# OpenReadCompletedEventArgs类的具体用法?C# OpenReadCompletedEventArgs怎么用?C# OpenReadCompletedEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



OpenReadCompletedEventArgs类属于System.Net命名空间,在下文中一共展示了OpenReadCompletedEventArgs类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Client_OpenReadCompleted

        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;
                }

            }
        }
开发者ID:jamessonfaria,项目名称:ExGame,代码行数:28,代码来源:PerfilJogosPage.xaml.cs


示例2: WebClientOpenReadCompleted

        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();
        }
开发者ID:trilok567,项目名称:Windows-Phone,代码行数:30,代码来源:Page1.xaml.cs


示例3: clientCities_OpenReadCompleted

        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;
        }
开发者ID:marcin-owoc,项目名称:TouristGuide,代码行数:25,代码来源:AttractionsCities.xaml.cs


示例4: client_OpenReadCompleted

        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.");
            }
        }
开发者ID:otavioschwanck,项目名称:precos_marcenaria_windows_phone,代码行数:32,代码来源:MainPage.xaml.cs


示例5: m_downloadClient_OpenReadCompleted

 void m_downloadClient_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e)
 {
     if (DownloadCompleted != null)
     {
         DownloadCompleted(e.Result);
     }
 }
开发者ID:deha,项目名称:NoteShare.Media,代码行数:7,代码来源:TransferManager.cs


示例6: webClient_OpenReadCompleted

        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);
            }
        }
开发者ID:kingaM,项目名称:RoboHome,代码行数:25,代码来源:MainPage.xaml.cs


示例7: callbackMethod

        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;
            }
        }
开发者ID:MediaPortal,项目名称:MPTagThat,代码行数:60,代码来源:EvilLabs.cs


示例8: ClientOpenReadCompleted

        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);
            }
        }
开发者ID:andrewmyhre,项目名称:andrewmyhredotcom,代码行数:28,代码来源:PreLoader.cs


示例9: downloader_OpenReadCompleted

        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 
            {
            }
        }
开发者ID:SmallMobile,项目名称:ranet-uilibrary-olap.latest-unstabilized,代码行数:35,代码来源:XapItemComboBox.xaml.cs


示例10: webClient_OpenReadCompleted

        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 
                });
        }
开发者ID:Esri,项目名称:arcgis-viewer-silverlight,代码行数:33,代码来源:WebClientHelper.cs


示例11: webc_OpenReadCompleted

        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();
        }
开发者ID:ioprev,项目名称:Apergies,代码行数:33,代码来源:AllStrikesLoader.cs


示例12: wc_OpenReadCompleted

        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));
                });
            }
        }
开发者ID:Natsuwind,项目名称:DeepInSummer,代码行数:26,代码来源:DownloadFilePage.xaml.cs


示例13: OnEmployeeServiceOpenReadComplete

        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();

        }
开发者ID:dannylee,项目名称:RGALocator,代码行数:25,代码来源:ColleagueDetails.xaml.cs


示例14: client_OpenReadCompleted

        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);
        }
开发者ID:oferhaze,项目名称:Ferrari,代码行数:28,代码来源:LockScreenService.cs


示例15: webc_OpenReadCompleted

        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();
        }
开发者ID:ioprev,项目名称:Apergies,代码行数:32,代码来源:StrikeLoader.cs


示例16: LineWebClient_Completed

 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;
     }
 }
开发者ID:zongjingyao,项目名称:WP8-OnlineBus,代码行数:28,代码来源:MainPage.xaml.cs


示例17: produto_OpenReadCompleted

        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);
            }
        }
开发者ID:lhlima,项目名称:CollaborationProjects,代码行数:25,代码来源:Listaprod.xaml.cs


示例18: webc_OpenReadCompleted

        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);
        }
开发者ID:ioprev,项目名称:Apergies,代码行数:33,代码来源:StrikeLoader.cs


示例19: webClient_OpenReadCompleted

        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);
            }
        }
开发者ID:Chengxuan,项目名称:BThere,代码行数:33,代码来源:PlayVideo.xaml.cs


示例20: WebClientOnOpenReadCompleted

        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();
            }
        }
开发者ID:karbazol,项目名称:FBReaderCS,代码行数:35,代码来源:DirectFileLoader.cs



注:本文中的System.Net.OpenReadCompletedEventArgs类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Net.Player类代码示例发布时间:2022-05-26
下一篇:
C# Net.NetworkCredential类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap