ターゲット バージョン .Net 4.5 でサービス コードを再生成する必要があります。async
次に、キーワードを使用できます。次のようなコードを記述します。
var client = new DashboardServicesClient("BasicHttpBinding_IDashboardServices", App.DashboardServicesAddress);
// Wait here until you get the result ...
var result = await client.SelectActiveDealsAsync();
// ... then refresh the ui synchronously.
RefreshDealsGridComplete(result);
または、ContinueWith
Methodeを使用します。
var client = new DashboardServicesClient("BasicHttpBinding_IDashboardServices", App.DashboardServicesAddress);
// Start the call ...
var resultAwaiter = client.SelectActiveDealsAsync();
// ... and define, what to do after finishing (while the call is running) ...
resultAwaiter.ContinueWith( async task => RefreshDealsGridComplete(await resultAwaiter));
// ... and forget it