本文整理汇总了C#中System.Net.DownloadStringCompletedEventArgs类的典型用法代码示例。如果您正苦于以下问题:C# DownloadStringCompletedEventArgs类的具体用法?C# DownloadStringCompletedEventArgs怎么用?C# DownloadStringCompletedEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DownloadStringCompletedEventArgs类属于System.Net命名空间,在下文中一共展示了DownloadStringCompletedEventArgs类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: WorldFileLoaded
private void WorldFileLoaded(object sender, DownloadStringCompletedEventArgs e)
{
//Checks to see if there was an error
if (e.Error == null)
{
//grab the data from the world file
string myData = e.Result;
//split string into an array based on new line characters
string[] lines = myData.Split(new string[] { "\r\n", "\n" }, StringSplitOptions.RemoveEmptyEntries);
//convert the strings into doubles
double[] coordValues = new double[6];
for(int i = 0; i < 6; i++) {
coordValues[i] = Convert.ToDouble(lines[i]);
}
//calculate the pixel height and width in real world coordinates
double pixelWidth = Math.Sqrt(Math.Pow(coordValues[0], 2) + Math.Pow(coordValues[1], 2));
double pixelHeight = Math.Sqrt(Math.Pow(coordValues[2], 2) + Math.Pow(coordValues[3], 2));
//Create a map point for the top left and bottom right
MapPoint topLeft = new MapPoint(coordValues[4], coordValues[5]);
MapPoint bottomRight = new MapPoint(coordValues[4] + (pixelWidth * imageWidth), coordValues[5] + (pixelHeight * imageHeight));
//create an envelope for the elmently layer
Envelope extent = new Envelope(topLeft.X, topLeft.Y, bottomRight.X, bottomRight.Y);
ElementLayer.SetEnvelope(image, extent);
//Zoom to the extent of the image
MyMap.Extent = extent;
}
}
开发者ID:ApexGIS,项目名称:developer-support,代码行数:28,代码来源:MainPage.xaml.cs
示例17: webClient_DownloadStringCompleted
void webClient_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
{
var rootObject = JsonConvert.DeserializeObject<Rootobject>(e.Result);
double lat, longitude;
MapPolyline line = new MapPolyline();
line.StrokeColor = Colors.Green;
line.StrokeThickness = 2;
double[] coord = new double[2 * rootObject.direction[0].stop.Length];
for (int i = 0; i < rootObject.direction[0].stop.Length; i++)
{
lat = Convert.ToDouble(rootObject.direction[0].stop[i].stop_lat);
longitude = Convert.ToDouble(rootObject.direction[0].stop[i].stop_lon);
line.Path.Add(new GeoCoordinate(lat, longitude));
Ellipse myCircle = new Ellipse();
myCircle.Fill = new SolidColorBrush(Colors.Green);
myCircle.Height = 15;
myCircle.Width = 15;
myCircle.Opacity = 60;
MapOverlay myLocationOverlay = new MapOverlay();
myLocationOverlay.Content = myCircle;
myLocationOverlay.PositionOrigin = new Point(0.5, 0.5);
myLocationOverlay.GeoCoordinate = new GeoCoordinate(lat, longitude, 200);
MapLayer myLocationLayer = new MapLayer();
myLocationLayer.Add(myLocationOverlay);
map.Layers.Add(myLocationLayer);
}
map.MapElements.Add(line);
}
开发者ID:huyle333,项目名称:windowsapp2013,代码行数:31,代码来源:GreenLine.xaml.cs
示例18: webClient_DownloadStringCompleted
private void webClient_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
{
IEnumerable<IdentityProviderInformation> identityProviders = null;
Exception error = e.Error;
if (null == e.Error)
{
try
{
using (MemoryStream ms = new MemoryStream(Encoding.Unicode.GetBytes(e.Result)))
{
DataContractJsonSerializer serializer = new DataContractJsonSerializer(typeof(IdentityProviderInformation[]));
identityProviders = serializer.ReadObject(ms) as IEnumerable<IdentityProviderInformation>;
IdentityProviderInformation windowsLiveId = identityProviders.FirstOrDefault(i => i.Name.Equals("Windows Live™ ID", StringComparison.InvariantCultureIgnoreCase));
if (windowsLiveId != null)
{
string separator = windowsLiveId.LoginUrl.Contains("?") ? "&" : "?";
windowsLiveId.LoginUrl = string.Format(CultureInfo.InvariantCulture, "{0}{1}pcexp=false", windowsLiveId.LoginUrl, separator);
}
}
}
catch(Exception ex)
{
error = ex;
}
}
if (null != GetIdentityProviderListCompleted)
{
GetIdentityProviderListCompleted(this, new GetIdentityProviderListEventArgs( identityProviders, error ));
}
}
开发者ID:junleqian,项目名称:Mobile-Restaurant,代码行数:33,代码来源:JSONIdentityProviderDiscoveryClient.cs
示例19: DownloadRapot
private void DownloadRapot(object sender, DownloadStringCompletedEventArgs e)
{
try
{
JObject jresult = JObject.Parse(e.Result);
JArray JItem = JArray.Parse(jresult.SelectToken("item").ToString());
foreach (JObject item in JItem)
{
ModelRapot modelRapot = new ModelRapot();
modelRapot.file_laporan = URL.BASE3 + "modul/mod_Laporan/laporan/" + item.SelectToken("file_laporan").ToString();
if (item.SelectToken("semester_pr").ToString() == "1")
{
modelRapot.semester_pr = item.SelectToken("semester_pr").ToString() + "st Semester";
}
else if (item.SelectToken("semester_pr").ToString() == "2")
{
modelRapot.semester_pr = item.SelectToken("semester_pr").ToString() + "nd Semester";
}
else if (item.SelectToken("semester_pr").ToString() == "3")
{
modelRapot.semester_pr = item.SelectToken("semester_pr").ToString() + "rd Semester";
}
else
{
modelRapot.semester_pr = item.SelectToken("semester_pr").ToString() + "th Semester";
}
collectionRapot.Add(modelRapot);
}
}
catch
{
konek = false;
}
}
开发者ID:Handika-GEMkey,项目名称:SolidareNew,代码行数:34,代码来源:ViewModelRapot.cs
示例20: WebClient_DownloadStringCompleted
static void WebClient_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
{
if (e.Error == null)
{
ParseImages((e.UserState as String), XDocument.Parse(e.Result));
}
}
开发者ID:shiftkey,项目名称:silverlight-winrt,代码行数:7,代码来源:ImageResult.cs
注:本文中的System.Net.DownloadStringCompletedEventArgs类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论