private void OnReportTimer(object o) { lock (_lock) { if (_running && _lastReportedToClient != _lastReportedCount) { _lastReportedToClient = _lastReportedCount; _progress = _progress ?? _progressService?.BeginProgress(); if (_lastReportedCount > 0) { _progress?.Report(Resources.AnalysisProgress.FormatUI(_lastReportedCount)).DoNotWait(); } } } }
private void UpdateProgressMessage() { var count = _server.EstimateRemainingWork(); if (count > 0) { _progress = _progress ?? _progressService.BeginProgress(); _progress.Report(count == 1 ? Resources.AnalysisProgress_SingleItemRemaining : Resources.AnalysisProgress_MultipleItemsRemaining.FormatInvariant(count)).DoNotWait(); } else { EndProgress(); } }
private async Task ProgressWorker() { await Task.Delay(1000); var remaining = _server.EstimateRemainingWork(); if (remaining > 0) { using (var p = _progress.BeginProgress()) { while (remaining > 0) { var items = remaining > 1 ? "items" : "item"; // TODO: in localization this needs to be two different messages // since not all languages allow sentence construction. await p.Report($"Analyzing workspace, {remaining} {items} remaining..."); await Task.Delay(100); remaining = _server.EstimateRemainingWork(); } } } _progressReportingTask = null; }