internal ProjectLoadProgress(string filePath, ProjectLoadOperation operation, string targetFramework, TimeSpan elapsedTime) { FilePath = filePath; Operation = operation; TargetFramework = targetFramework; ElapsedTime = elapsedTime; }
private async Task <TResult> DoOperationAndReportProgressAsync <TResult>( ProjectLoadOperation operation, string?projectPath, string?targetFramework, Func <Task <TResult> > doFunc ) { var watch = _progress != null?Stopwatch.StartNew() : null; TResult result; try { result = await doFunc().ConfigureAwait(false); } finally { if (_progress != null && watch != null) { watch.Stop(); _progress.Report( new ProjectLoadProgress( projectPath ?? string.Empty, operation, targetFramework, watch.Elapsed ) ); } } return(result); }