-1
我需要在Windows Phone應用程序中使用java web服務,但我不知道確切的過程。但我嘗試了下面的代碼,但不工作請告訴我確切的程序或樣本之一。Windows Phone應用程序如何使用來自java webservice的數據
ObservableCollection<Class1> p = new ObservableCollection<Class1>();
public Antocids()
{
InitializeComponent();
listBox1.DataContext=p;
ServiceReference3.ProductsClient client = new ServiceReference3.ProductsClient();
client.getProdDetailsCompleted += new EventHandler<ServiceReference3.getProdDetailsCompletedEventArgs>(client_getProdDetailsCompleted);
client.getProdDetailsAsync();
}
private void client_getProdDetailsCompleted(object sender, ServiceReference3.getProdDetailsCompletedEventArgs e)
{
p.Clear(); // assuming you want to clear the data each time you get a new result
foreach(var result in e.Result)
p.Add(result)
}
//and this is my class
public class Class1
{
public string name { get; set; }
}
它不是以何種方式工作?異常?嗯? – ColinE 2012-03-29 05:16:37
是在p.add(result)發生錯誤;傳遞了無效參數 – user1151378 2012-03-29 05:23:49