[索引页]
[源码下载]
作者:webabcd
介绍
Silverlight 2.0 调用REST服务,处理JSON格式,RSS/ATOM格式的数据
通过 System.Net.WebClient 类调用 REST 服务
通过 System.Json 命名控件下的类处理 JSON 数据
通过 System.Xml.Linq 命名空间下的类(LINQ to XML)处理 XML 数据
通过 System.ServiceModel.Syndication 命名空间下的类处理 RSS/ATOM 数据
在线DEMO
http://www.voidcn.com/article/p-ounmxjds-tq.html
示例
1、调用 REST 服务,返回 JSON 数据
REST.cs(WCF创建的REST服务)
/// <summary>
/// 提供 REST 服务的类
/// 注:Silverlight只支持 GET 和 POST
/// </summary>
[源码下载]
作者:webabcd
介绍
Silverlight 2.0 调用REST服务,处理JSON格式,RSS/ATOM格式的数据
通过 System.Net.WebClient 类调用 REST 服务
通过 System.Json 命名控件下的类处理 JSON 数据
通过 System.Xml.Linq 命名空间下的类(LINQ to XML)处理 XML 数据
通过 System.ServiceModel.Syndication 命名空间下的类处理 RSS/ATOM 数据
在线DEMO
http://www.voidcn.com/article/p-ounmxjds-tq.html
示例
1、调用 REST 服务,返回 JSON 数据
REST.cs(WCF创建的REST服务)
/// <summary>
/// 提供 REST 服务的类
/// 注:Silverlight只支持 GET 和 POST
/// </summary>
Json.xaml
<UserControl x:Class="Silverlight20.Communication.Json"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<StackPanel HorizontalAlignment="Left" Width="600">
<TextBox x:Name="txtMsgJson" Margin="5" />
<TextBox x:Name="txtMsgJson2" Margin="5" />
</StackPanel>
</UserControl>
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<StackPanel HorizontalAlignment="Left" Width="600">
<TextBox x:Name="txtMsgJson" Margin="5" />
<TextBox x:Name="txtMsgJson2" Margin="5" />
</StackPanel>
</UserControl>
Json.xaml.cs
OK
[源码下载]
[源码下载]
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。