Esempio n. 1
0
 private static void OnInstallationDone(object sender, InstallResult results)
 {
     if (!_handler.UserCancellation.IsCancellationRequested && results.MustRestart)
     {
         VsHelpers.PromptForRestart(_settings);
     }
 }
Esempio n. 2
0
        private async Task <InstallResult> InstallAsync(IEnumerable <ExtensionEntry> extensions, IVsExtensionRepository repository, IVsExtensionManager manager, CancellationToken token)
        {
            _log.Debug("InstallAsync started");
            if (!extensions.Any() || token.IsCancellationRequested)
            {
                return(InstallResult.NothingToDo);
            }

            return(await Task.Factory.StartNew <InstallResult>(() =>
            {
                var ret = new InstallResult();
                try
                {
                    foreach (ExtensionEntry extension in extensions)
                    {
                        if (token.IsCancellationRequested)
                        {
                            return ret;
                        }

                        var result = InstallExtension(extension, repository, manager);
                        ret.AddResult(extension, result);
                    }
                }
                catch (Exception ex)
                {
                    _logger.Log("Error installing " + ex.Message);
                }
                finally
                {
                    Store.Save();
                }

                return ret;
            }, token).ConfigureAwait(false));
        }