当前位置: 首页>>代码示例>>C#>>正文


C# Net.DownloadStringCompletedEventArgs类代码示例

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


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

示例1: web_DownloadStringCompleted

        void web_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
        {
            Progress.IsIndeterminate = false;
            ((ApplicationBarIconButton)ApplicationBar.Buttons[1]).IsEnabled = true;

            try
            {
                PromoCardObject deserializedResponse = JsonConvert.DeserializeObject<PromoCardObject>(e.Result);
                if (deserializedResponse.error == null)
                {
                    foreach (Image item in stampCanvas.Children)
                    {
                        item.Opacity = 0;
                    }
                    for (int i = 0; i < deserializedResponse.data[0].AvaliableCount; i++)
                    {
                        stampCanvas.Children[i].Opacity = 1;
                    }
                }
                else
                {
                    MessageBox.Show(deserializedResponse.error.Message);
                }
            }
            catch (Exception)
            {
                MessageBox.Show("İnternet bağlantınızla ilgili bir sorun var");
            }
        }
开发者ID:anilakuzum,项目名称:CafeNeroTRWP,代码行数:29,代码来源:Landing.xaml.cs

示例2: client_DownloadStringCompleted

        private void client_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
        {
            if (e.Error == null)
            {
                int itemsCount = 7;
                xmlReader = XmlReader.Create(new StringReader(e.Result));
                feed = SyndicationFeed.Load(xmlReader);

                List<RSSItem> itemsList = new List<RSSItem>();

                if (feed.Items.Count() < 7)
                {
                    itemsCount = feed.Items.Count();
                }

                for (int i = 0; i <= itemsCount; i++)
                {
                    RSSItem rssitem = new RSSItem();
                    rssitem.RSSTitle = feed.Items.ToList()[i].Title.Text;
                    rssitem.RSSLink = feed.Items.ToList()[i].Links[0].Uri;
                    itemsList.Add(rssitem);
                }
                RSS.ItemsSource = itemsList;
            }
        }
开发者ID:coreyperkins,项目名称:Kendor-Site,代码行数:25,代码来源:RSSReader.xaml.cs

示例3: HandleCompletedDownload

 void HandleCompletedDownload(object sender, DownloadStringCompletedEventArgs e, DownloadType type)
 {
     switch (type)
     {
         case DownloadType.RecentPlaylist:
             {
                 Parsers.ParseRecentPlaylist(e.Result);
                 break;
             }
         case DownloadType.MostPlayedPlaylist:
             {
                 Parsers.ParseMostPlayed(e.Result);
                 break;
             }
         case DownloadType.FavoritePlaylist:
             {
                 Parsers.ParseFavorites(e.Result);
                 break;
             }
         case DownloadType.BadgeList:
             {
                 Parsers.ParseBadges(e.Result);
                 break;
             }
         case DownloadType.FriendList:
             {
                 Parsers.ParseFriends(e.Result);
                 break;
             }
     }
 }
开发者ID:fstn,项目名称:WindowsPhoneApps,代码行数:31,代码来源:Downloader.cs

示例4: handleDownloadStringComplete

        private void handleDownloadStringComplete(object sender, DownloadStringCompletedEventArgs e)
        {
            if (Microsoft.Phone.Net.NetworkInformation.DeviceNetworkInformation.IsNetworkAvailable)
            {
                XNamespace media = XNamespace.Get("http://search.yahoo.com/mrss/");
                titles = System.Xml.Linq.XElement.Parse(e.Result).Descendants("title")
                    .Where(m => m.Parent.Name == "item")
                    .Select(m => m.Value)
                    .ToArray();

                descriptions = XElement.Parse(e.Result).Descendants("description")
                    .Where(m => m.Parent.Name == "item")
                    .Select(m => m.Value)
                    .ToArray();

                images = XElement.Parse(e.Result).Descendants(media + "thumbnail")
                    .Where(m => m.Parent.Name == "item")
                    .Select(m => m.Attribute("url").Value)
                    .ToArray();

                SpeechSynthesizer synth = new SpeechSynthesizer();
                synth.SpeakTextAsync(titles[0]).Completed += new AsyncActionCompletedHandler(delegate(IAsyncAction action, AsyncStatus status)
                    {
                        synth.SpeakTextAsync(descriptions[0]);
                    });
                UpdatePrimaryTile(titles[0], images[0]);

            }
            else
            {
                MessageBox.Show("No network is available...");
            }
        }
开发者ID:king-dev,项目名称:WP8_RssNewsReader,代码行数:33,代码来源:MainPage.xaml.cs

示例5: Downloaded

        /// <summary>
        /// Download is completed
        ///  *Craate list
        ///  *sent event 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e">arguments of download call</param>
        private void Downloaded(object sender, DownloadStringCompletedEventArgs e)
        {
            try
            {
                if (!e.Cancelled)
                {
                    var xml = XElement.Parse(e.Result);
                    var items = xml.Elements("channel").Elements("item").Select(element => new RssFeedItem
                                                                                               {
                                                                                                   Description = (ReadElement(element, "description")),
                                                                                                   Title = ReadElement(element, "title"),
                                                                                                   Link = ReadElement(element, "link"),
                                                                                                   PublishDate = DateTime.Parse(ReadElement(element, "pubDate"))
                                                                                               }).ToList();

                    if (ReadRssCompleted != null)
                        ReadRssCompleted(this, new ReadFeedCallbackArguments {FeedItems = items});
                }

            }
            catch (Exception)
            {
                  if (ReadRssCompleted != null)
                        ReadRssCompleted(this, new ReadFeedCallbackArguments {ErrorMessage = "Error occurred..."});
            }
        }
开发者ID:nielsschroyen,项目名称:RssReader,代码行数:33,代码来源:RssDownloader.cs

示例6: webClient_DownloadStringCompleted

        /// <summary>
        /// Web service completed event
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void webClient_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
        {
            try
            {
                if (e.Error == null && e.Result != null && e.Result.Count() != 2)
                {
                    conditionLeaflets = JsonHelper.Deserialize<ConditionSearchCollection>(e.Result);

                    objConditionSearchViewModel.SearchCollection = conditionLeaflets;
                    objConditionSearchViewModel.ProgressBarVisibilty = Visibility.Collapsed;
                    objConditionSearchViewModel.NoLeafletTextVisibility = Visibility.Collapsed;
                }
                else
                {
                    objConditionSearchViewModel.NoLeafletTextVisibility = Visibility.Visible;
                    objConditionSearchViewModel.ProgressBarVisibilty = Visibility.Collapsed;
                }
            }
            catch (Exception)
            {
                objConditionSearchViewModel.ProgressBarVisibilty = Visibility.Collapsed;
                
                MessageBox.Show("Sorry, Unable to process your request.");

            }

        } 
开发者ID:EdytaSzkiladz,项目名称:MyLocalPharmacy,代码行数:32,代码来源:ConditionSearchModel.cs

示例7: LoadDescriptionCompleted

        private void LoadDescriptionCompleted(object sender, DownloadStringCompletedEventArgs e)
        {
            string html = e.Result;
              try
              {

            string one = html.Substring(html.IndexOf("Explanation:"));
            string two = one.Substring(one.IndexOf(">") + 1);
            string three = two.Substring(0, two.IndexOf(@"<p>"));
            Explanation.Text = three;
              }
              catch
              {
            Explanation.Text = "Visit the NASA web site for a description.";
              }

              string imgroot = "http://apod.nasa.gov/apod/";

              try
              {
            string four = html.Substring(html.IndexOf("<IMG SRC=") + 10);
            string url = four.Substring(0, four.IndexOf('"'));
            _todayUrl = imgroot + url;
              }
              catch
              {
            _todayUrl = "http://apod.nasa.gov/apod/calendar/today.jpg";
              }
        }
开发者ID:xghpro,项目名称:APOD-Metro-Phone,代码行数:29,代码来源:MainPage.xaml.cs

示例8: webClient_DownloadStringCompleted

 void webClient_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
 {
     if (e.Error == null)
     {
         verifyAuth(e.Result);
     }
 }
开发者ID:nounjog,项目名称:ITWEM1_Project,代码行数:7,代码来源:MainPage.xaml.cs

示例9: client_DownloadStringCompleted

        private void client_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
        {
            if (e.Error == null)
            {
                try
                {
                    JObject json = JObject.Parse(e.Result);
                    Version current = Assembly.GetExecutingAssembly().GetName().Version;
                    Version latest = Version.Parse((string)json["win"]["version"]);
                    Uri latestUrl = new Uri((string)json["win"]["url"], UriKind.Absolute);

                    if(Completed != null)
                    {
                        Completed(this, new UpdateAvailableEventArgs()
                            {
                                UpdateAvailable = latest > current,
                                CurrentVersion = current.ToString(),
                                NewVersion = latest.ToString(),
                                NewVersionUri = latestUrl
                            });
                    }
                }
                catch (Exception ex)
                {
                    OnException(ex);
                }
            }
            else
            {
                OnException(e.Error);
            }
        }
开发者ID:pleasereset,项目名称:wakemypc-lighthouse,代码行数:32,代码来源:Updater.cs

示例10: verCheck_DownloadStringCompleted

        void verCheck_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
        {
            Assembly assembly = Assembly.GetExecutingAssembly();
            FileVersionInfo fvi = FileVersionInfo.GetVersionInfo(assembly.Location);

            try
            {
                if (e.Result.ToString().Equals(fvi.FileVersion) == false)
                {
                    if (MessageBox.Show("New version availible - " + e.Result.ToString() + ", do you want to visit the download site?", "Download new version?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        string strTarget = "https://github.com/nccgroup/ncccodenavi";

                        try
                        {
                            System.Diagnostics.Process.Start(strTarget);
                        }
                        catch (System.ComponentModel.Win32Exception noBrowser)
                        {
                            if (noBrowser.ErrorCode == -2147467259) MessageBox.Show(noBrowser.Message);
                        }
                        catch (System.Exception other)
                        {
                            MessageBox.Show(other.Message);
                        }

                    }
                }
            }
            catch (Exception)
            {

            }
        }
开发者ID:etdsoft,项目名称:ncccodenavi,代码行数:34,代码来源:VersionCheck.cs

示例11: WebClient_DownloadStringCompleted

        private void WebClient_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
        {
            if (e.Error != null || string.IsNullOrEmpty(e.Result))
                return;

            // Deserialize the list of layouts
            XmlSerializer serializer = new XmlSerializer(typeof(LayoutInfoCollection)); 
            LayoutInfoCollection layoutList = null;
            using (TextReader reader = new StringReader(e.Result))
            {
                layoutList = (LayoutInfoCollection)serializer.Deserialize(reader);
            }

            // Update UI with layouts list
            if (layoutList != null && layoutList.Layouts != null)
            {
                LayoutsListBox.ItemsSource = Layouts.ItemsSource = layoutList.Layouts;
                if (layoutList.Layouts.Count > 0)
                {
                    CurrentSelectedLayoutInfo = layoutList.Layouts.ElementAtOrDefault(0);
                    if (CurrentSelectedLayoutInfo != null)
                        LayoutsListBox.SelectedItem = Layouts.SelectedItem = CurrentSelectedLayoutInfo;
                }            
            }
        }
开发者ID:konglingjie,项目名称:arcgis-viewer-silverlight,代码行数:25,代码来源:LayoutPickerControl.xaml.cs

示例12: ClientPlacesDownloadStringCompleted

        void ClientPlacesDownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
        {
            try
            {
                if (e.Error == null)
                {
                    using (MemoryStream stream = new MemoryStream(Encoding.Unicode.GetBytes(e.Result)))
                    {
                        //It doesn't work in Windows Phone, I should change the name of the properties y the models
                        //DataContractJsonSerializerSettings settings =
                        //        new DataContractJsonSerializerSettings();
                        //settings.UseSimpleDictionaryFormat = true;

                        DataContractJsonSerializer serializer =
                                new DataContractJsonSerializer(typeof(List<Place>));

                        this.Places = serializer.ReadObject(stream) as List<Place>;

                    }

                    this.DownloadDataResult = Enumerations.Result.Successful;
                }
                else
                {
                    this.DownloadDataResult = Enumerations.Result.ServiceError;
                }
            }
            catch (Exception)
            {
                this.DownloadDataResult = Enumerations.Result.ApplicationError;
            }
        }
开发者ID:soreygarcia,项目名称:AppMovil-BarCamMed,代码行数:32,代码来源:ServicesAccess.cs

示例13: webClient_DownloadStringCompleted

        private void webClient_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
        {
            try
            {
                if (e != null && e.Error == null)
                {
                    var data = e.Result;
                    XmlDocument _doc = new XmlDocument();
                    _doc.LoadXml(data);
                   
                    if (_doc.GetElementsByTagName("zigbeeData").Count > 0)
                    {
                        string zigbeeData = _doc.GetElementsByTagName("zigbeeData")[0].InnerText;


                        Zigbit zigbit = _zigbitService.CollectData(zigbeeData);
                        if (zigbit != null)
                        {
                            UpdateZigbit(zigbit);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                ErrorHandlingService.PersistError("GatewayService - webClient_DownloadStringCompleted", ex);
                
            }
        }
开发者ID:AllanWLie,项目名称:UnitGate,代码行数:29,代码来源:GatewayService.cs

示例14: NewsDownloaded

        void NewsDownloaded(object sender, DownloadStringCompletedEventArgs e)
        {
            if (e.Result == null || e.Error != null)
            {
                MessageBox.Show("There was an error downloading the XML-file!");
            }
            else
            {
                // Deserialize if download succeeds
                XmlSerializer serializer = new XmlSerializer(typeof(Articles));
                XDocument document = XDocument.Parse(e.Result);
                var news = from query in document.Descendants("item")
                           select new Article
                           {
                               Title = (string)query.Element("title"),
                               Description = (string)query.Element("description").Value.ToString().Replace("<![CDATA[", "").Replace("]]>", "").Replace("<p>", "").Replace("</p>", "").Replace("\n", "").Replace("\t", "").Replace("<p style=", "").Replace("text-align: justify; ", "").Replace(">", "").Replace(@"""", "").Substring(0, 20) + "...",
                               Description1 = (string)query.Element("description").Value.ToString().Replace("<![CDATA[", "").Replace("]]>", ""),
                               Pubdate = (string)query.Element("pubdate")

                               //Title = (query.Element("title") == null) ? "" : (string)query.Element("title").Value.ToString().Replace("<![CDATA[", "").Replace("]]>", ""),

                               //Pubdate = (query.Element("pubdate") == null) ? "" : (string)query.Element("pubdate").Value.ToString()
                           };
                newsList.ItemsSource = news;
            }
        }
开发者ID:JadhavArchana,项目名称:FinalPro,代码行数:26,代码来源:CATNewsPage.xaml.cs

示例15: webClient_DownloadStringCompleted

        void webClient_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
        {
            toolStripStatusLabel1.Text = "";
            htmlSource = e.Result;

            initializeManga();
        }
开发者ID:mythseur,项目名称:Manga-Downloader,代码行数:7,代码来源:ListChaptersWindow.cs


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