2 tizon1987 tizon1987 于 2014.05.27 15:45 提问

silverlight调用wcf后无法执行

private void LayoutRoot_Loaded(object sender, RoutedEventArgs e)
{
platformClient = new PlatformDB.PlatformDBClient();
platformClient.GetEntityDataCompleted += new EventHandler(platformClient_GetEntityDataCompleted);
platformClient.GetEntityDataAsync();
}
void platformClient_GetEntityDataCompleted(object sender, PlatformDB.GetEntityDataCompletedEventArgs e)
{
try
{
if (e.Result != null)
{
foreach (var item in e.Result)
{
TreeViewItem tviItem = new TreeViewItem() { Header = item.EntityIsBelong };
foreach (var items in item.dirEntity)
{
if (items.Key == item.EntityIsBelong)
{
foreach (var entity in items.Value.OrderBy(c => c.IsEntity).ToList())
{
TreeViewItem tvItem = new TreeViewItem() { Header = entity.EntityName };
tviItem.Items.Add(tvItem);
}

}
}
tvEntity.Items.Add(tviItem);
}
}
}
catch
{
}
}
这是完整的程序代码,执行后,程序无法进入 platformClient_GetEntityDataCompleted ,导致程序运行不起来。WCF 有数据返回。

Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!