public void Start() { Run(async() => { await _outputConsole.ActivateAsync(); await _outputConsole.ClearAsync(); await NuGetUIThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); _errorList.Value.ClearNuGetEntries(); }); }
public async Task StartAsync( RestoreOperationSource operationSource, Lazy <ErrorListTableDataSource> errorListDataSource, JoinableTaskFactory jtf, CancellationTokenSource cts) { Assumes.Present(errorListDataSource); Assumes.Present(jtf); Assumes.Present(cts); _operationSource = operationSource; _errorListDataSource = errorListDataSource; _jtc = jtf.Context.CreateCollection(); _taskFactory = jtf.Context.CreateFactory(_jtc); _externalCts = cts; _externalCts.Token.Register(() => _cancelled = true); _progressFactory = t => StatusBarProgress.StartAsync(_asyncServiceProvider, _taskFactory, t); await _taskFactory.RunAsync(async() => { OutputVerbosity = await GetMSBuildOutputVerbositySettingAsync(); switch (_operationSource) { case RestoreOperationSource.Implicit: // background auto-restore _outputConsole = _outputConsoleProvider.CreatePackageManagerConsole(); break; case RestoreOperationSource.OnBuild: _outputConsole = _outputConsoleProvider.CreateBuildOutputConsole(); await _outputConsole.ActivateAsync(); break; case RestoreOperationSource.Explicit: _outputConsole = _outputConsoleProvider.CreatePackageManagerConsole(); await _outputConsole.ActivateAsync(); await _outputConsole.ClearAsync(); break; } }); if (_errorListDataSource.IsValueCreated) { // Clear old entries _errorListDataSource.Value.ClearNuGetEntries(); } }