Exemple #1
0
 public ServerProvider(AsyncPackage package, Type optionsPageType)
 {
     _options = new AsyncLazy <ServerOptionsPageBase>(
         () => package.GetDialogPageAsync <ServerOptionsPageBase>(optionsPageType),
         joinableTaskFactory: package.JoinableTaskFactory
         );
 }
Exemple #2
0
        public HandlerSettingProvider(AsyncPackage package, Func <T, object> valueProvider)
        {
            _valueProvider = valueProvider;

            _dialogPage = new AsyncLazy <T>(
                () => package.GetDialogPageAsync <T>(),
                joinableTaskFactory: package.JoinableTaskFactory
                );
        }
        public static async Task ShowExceptionAsync(this AsyncPackage asyncPackage, Exception ex)
        {
            await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(CancelAllToken);

            if (CancelAllToken.IsCancellationRequested)
            {
                return;
            }

            string mainMessage   = ex.ToString();
            var    messageSuffix = "";

            if (m_FullVsVersion < m_LowestSupportedVersion)
            {
                messageSuffix = $"{Environment.NewLine}This extension only supports VS {m_LowestSupportedVersion}+, you are currently using {m_FullVsVersion}";
            }

            if (m_FullVsVersion.Major < 16)
            {
                messageSuffix = $"{Environment.NewLine}Support for VS2017 (15.*) is likely to end this year. You're using: {m_FullVsVersion}";
            }

            if (ex is FileNotFoundException fnf && !string.IsNullOrEmpty(fnf.FusionLog))
            {
                try {
                    var options = await asyncPackage.GetDialogPageAsync <ConverterOptionsPage>();

                    if (!options.BypassAssemblyLoadingErrors)
                    {
                        options.BypassAssemblyLoadingErrors = true;
                        options.SaveSettingsToStorage();
                        mainMessage =
                            $"Assembly load issue detected. Tools->Options->Code Converter->BypassAssemblyLoadingErrors has now been automatically activated, please try again (but report this issue either way).{Environment.NewLine}";
                    }
                } catch {
                    mainMessage =
                        $"Assembly load issue detected. Try activating Tools->Options->Code Converter->Bypass assembly loading errors and try again (but report this issue either way).{Environment.NewLine}";
                }

                mainMessage   += $"{ex.Message}{Environment.NewLine}{GetShortStackTrace(ex)}";
                messageSuffix += $"{Environment.NewLine}{fnf.FusionLog}{Environment.NewLine}";
            }

            MessageBox.Show($"An error has occurred during conversion - press Ctrl+C to copy the details: {mainMessage}{messageSuffix}",
                            m_Title, MessageBoxButton.OK, MessageBoxImage.Error);
        }
Exemple #4
0
    public Settings(AsyncPackage package)
    {
        _generalOptions = new AsyncLazy <GeneralOptionsPage>(
            () => package.GetDialogPageAsync <GeneralOptionsPage>(),
            joinableTaskFactory: package.JoinableTaskFactory
            );

        _serverProviders = new Dictionary <string, ServerProvider>()
        {
            { "azureDevOpsServer", new ServerProvider(package, typeof(AzureDevOpsServerOptionsPage)) },
            { "bitbucketServer", new ServerProvider(package, typeof(BitbucketServerOptionsPage)) },
            { "gitHubEnterprise", new ServerProvider(package, typeof(GitHubEnterpriseOptionsPage)) },
            { "gitLabEnterprise", new ServerProvider(package, typeof(GitLabEnterpriseOptionsPage)) },
            { "gitiles", new ServerProvider(package, typeof(GitilesOptionsPage)) }
        };

        _handlerSettings = new() {
            { "useGitHubDev", new HandlerSettingProvider <GitHubOptionsPage>(package, (x) => x.UseGitHubDev) }
        };
    }
Exemple #5
0
 public static Task <T> GetDialogPageAsync <T>(this AsyncPackage package) where T : DialogPage
 {
     return(package.GetDialogPageAsync <T>(typeof(T)));
 }