使用SilverLight构建插件式应用程序(六)
2008-10-23 11:43:40 来源:WEB开发网NotesMain.xaml:显示的留言主界面;
这是整个插件的核心部分,实现了读取数据,生成数据项,显示,翻页等等功能。
1:实现IPlugIn接口,这个是每个插件都要实现的功能;
2:获取整个留言的页数,为分页显示最准备,下面是代码:
private void DataCount()
{
Uri uri = System.Windows.Browser.HtmlPage.Document.DocumentUri;
string host = uri.AbsoluteUri;
host = host.Substring(0, host.Length - uri.LocalPath.Length);
string servicePath = "/Services/WSNotes.svc";
string serviceUri = host + servicePath;
//
WSNotesClient ws = new WSNotesClient(new System.ServiceModel.BasicHttpBinding(), new System.ServiceModel.EndpointAddress(serviceUri));
ws.GetNotesCountCompleted += (o, ev) =>
{
if (ev.Error == null)
{
int tmpCount = ev.Result / PageSize;
if (tmpCount * PageSize == ev.Result)
{
PageCount = tmpCount;
}
else
{
PageCount = tmpCount + 1;
}
this.txtPageCount.Text = "/" + PageCount;
//
DataLoad(1);
}
};
ws.GetNotesCountAsync();
}
Tags:使用 SilverLight 构建
编辑录入:爽爽 [复制链接] [打 印]更多精彩
赞助商链接