Reputation: 9733
I am trying to call a WCF service in a windows universal application and apparently you can only call the function "GetMoments" asynchronously. But I can't get the ObservableCollection filled.
EndpointAddress address = new EndpointAddress("net.tcp://localhost:9999/DeliveryService");
NetTcpBinding binding = new NetTcpBinding(SecurityMode.None);
DeliveryClient client = new DeliveryClient(binding, address);
Task<ObservableCollection<DeliveryMoment>> moments = client.GetMomentsAsync();
moments.Wait() just waits forever and calling moments.Start() is not allowed, this throws an exception. How can I get the collection filled?
Upvotes: 1
Views: 532
Reputation: 1385
Could you please test with await/async pattern ? For example:
public async void Load()
{
EndpointAddress address = new EndpointAddress("net.tcp://localhost:9999/DeliveryService");
NetTcpBinding binding = new NetTcpBinding(SecurityMode.None);
DeliveryClient client = new DeliveryClient(binding, address);
ObservableCollection<DeliveryMoment> moments = await client.GetMomentsAsync();
}
Upvotes: 1