public static async Tasks.Task RunAsync() { bool hasUpdates = await Installer.CheckForUpdatesAsync(); if (!hasUpdates) { return; } _hasShownProgress = false; // Waits for MEF to initialize before the extension manager is ready to use await _package.GetServiceAsync(typeof(SComponentModel)); var repository = await _package.GetServiceAsync(typeof(SVsExtensionRepository)) as IVsExtensionRepository; var manager = await _package.GetServiceAsync(typeof(SVsExtensionManager)) as IVsExtensionManager; Version vsVersion = VsHelpers.GetVisualStudioVersion(); _handler = await SetupTaskStatusCenter(); Tasks.Task task = Installer.RunAsync(vsVersion, repository, manager, _handler.UserCancellation); _handler.RegisterTask(task); }
private static void OnInstallationDone(object sender, int count) { if (!_handler.UserCancellation.IsCancellationRequested && count > 0) { VsHelpers.PromptForRestart(); } }
private static void OnUpdate(object sender, Progress progress) { var data = new TaskProgressData { ProgressText = progress.Text, PercentComplete = progress.Percent, CanBeCanceled = true }; _handler.Progress.Report(data); if (!_hasShownProgress) { _hasShownProgress = true; VsHelpers.ShowTaskStatusCenter(); } }