2016-12-14 9 views
0

_reportViewerService.ShowReportが開始される前にGetRecordsが完了するようにコールする方法。 SignalRを使用すると、setUiはgetRecordsで計算された結果の一部から名前を表示するtxtフィールドを更新し、残りはレポートの後にレポートに出力されます。Async:2つ目のメソッドが開始する前に1つのメソッドを完了する方法

(同時に両方を実行している今起こっていただきました!私はライブアップデートのステータスを確認する前に、そのレポートが示したされている)事前に

おかげ

public async Task ViewReport() 
{ 

    var reportData = await _apiCallExecutor.ExecuteAsync(new GetRecords(queryModel, setUiHooks)); 
    try 
    { 
     if (reportData.Count > 0) 
     { 
     var settings = new ReportSettings(); 
     settings.ReportPath = "Utilities/SetDeliveryIdByBatchReport"; 
     settings.ReportTitle = "Set Delivery ID By Batch - Exception Listing"; 
     settings.DataSources.Add("DeliveryIdExceptionRecords", reportData); 
     ReportStatus = "Printing Exception Report..."; 
     await _reportViewerService.ShowReport(settings); 
     } 
    } 
    finally 
    { 
    ViewModelState = ViewModelStates.Edit; 
    } 

    ReportStatus = "Done..."; 
} 

答えて

0

あなたが」のいくつかの種類を使用したいです例えば、IObservableまたはTaskからデータが到着すると完了する。その後、

class GetRecords 
{ 
    ... 
    public Task Done { get; } 
    // or: public IObservable<Unit> Done { get; } 
} 

var getRecords = new GetRecords(queryModel, setUiHooks); 
var reportData = await _apiCallExecutor.ExecuteAsync(getRecords); 
await getRecords.Done; 
... 
関連する問題