Ejemplo n.º 1
0
        private void ShowGoldBar()
        {
            // If the gold bar is already open, do not show
            if (_infoBarOpen)
            {
                return;
            }

            _infoBarOpen = true;

            Debug.Assert(_experimentationService.IsExperimentEnabled(InternalFlightName) ||
                         _experimentationService.IsExperimentEnabled(ExternalFlightName));

            var message = ServicesVSResources.We_notice_you_suspended_0_Reset_keymappings_to_continue_to_navigate_and_refactor;

            KeybindingsResetLogger.Log("InfoBarShown");
            var infoBarService = _workspace.Services.GetRequiredService <IInfoBarService>();

            infoBarService.ShowInfoBarInGlobalView(
                string.Format(message, ReSharperExtensionName),
                new InfoBarUI(title: ServicesVSResources.Reset_Visual_Studio_default_keymapping,
                              kind: InfoBarUI.UIKind.Button,
                              action: RestoreVsKeybindings),
                new InfoBarUI(title: string.Format(ServicesVSResources.Apply_0_keymapping_scheme, ReSharperKeyboardMappingName),
                              kind: InfoBarUI.UIKind.Button,
                              action: OpenExtensionsHyperlink),
                new InfoBarUI(title: string.Format(ServicesVSResources.Apply_0_keymapping_scheme, VSCodeKeyboardMappingName),
                              kind: InfoBarUI.UIKind.Button,
                              action: OpenExtensionsHyperlink),
                new InfoBarUI(title: ServicesVSResources.Never_show_this_again,
                              kind: InfoBarUI.UIKind.HyperLink,
                              action: NeverShowAgain),
                new InfoBarUI(title: "", kind: InfoBarUI.UIKind.Close,
                              action: InfoBarClose));
        }
Ejemplo n.º 2
0
        private void ShowGoldBar()
        {
            AssertIsForeground();

            // If the gold bar is already open, do not show
            if (_infoBarOpen)
            {
                return;
            }

            _infoBarOpen = true;

            Debug.Assert(_experimentationService.IsExperimentEnabled(InternalFlightName) ||
                         _experimentationService.IsExperimentEnabled(ExternalFlightName));

            string message = ServicesVSResources.Disabling_the_extension_0_unbound_your_keyboard_bindings;

            KeybindingsResetLogger.Log("InfoBarShown");
            var infoBarService = _workspace.Services.GetRequiredService <IInfoBarService>();

            infoBarService.ShowInfoBarInGlobalView(
                string.Format(message, ReSharperExtensionName),
                new InfoBarUI(title: ServicesVSResources.Restore_Visual_Studio_keybindings,
                              kind: InfoBarUI.UIKind.Button,
                              action: RestoreVsKeybindings),
                new InfoBarUI(title: ServicesVSResources.Use_Keybindings_for_extensions,
                              kind: InfoBarUI.UIKind.Button,
                              action: OpenExtensionsHyperlink),
                new InfoBarUI(title: ServicesVSResources.Never_show_this_again,
                              kind: InfoBarUI.UIKind.HyperLink,
                              action: NeverShowAgain),
                new InfoBarUI(title: "", kind: InfoBarUI.UIKind.Close,
                              action: InfoBarClose));
        }
Ejemplo n.º 3
0
        private void NeverShowAgain()
        {
            _workspace.Options = _workspace.Options.WithChangedOption(KeybindingResetOptions.NeverShowAgain, true)
                                 .WithChangedOption(KeybindingResetOptions.NeedsReset, false);
            KeybindingsResetLogger.Log("NeverShowAgain");

            // The only external references to this object are as callbacks, which are removed by the Shutdown method.
            ThreadingContext.JoinableTaskFactory.Run(ShutdownAsync);
        }
Ejemplo n.º 4
0
        private void OpenExtensionsHyperlink()
        {
            ThisCanBeCalledOnAnyThread();

            BrowserHelper.StartBrowser(KeybindingsFwLink);

            KeybindingsResetLogger.Log("ExtensionsLink");
            _workspace.Options = _workspace.Options.WithChangedOption(KeybindingResetOptions.NeedsReset, false);
        }
        private void NeverShowAgain()
        {
            AssertIsForeground();

            _workspace.Options = _workspace.Options.WithChangedOption(KeybindingResetOptions.NeverShowAgain, true)
                                 .WithChangedOption(KeybindingResetOptions.NeedsReset, false);
            KeybindingsResetLogger.Log("NeverShowAgain");

            // The only external references to this object are as callbacks, which are removed by the Shutdown method.
            Shutdown();
        }
Ejemplo n.º 6
0
        private void OpenExtensionsHyperlink()
        {
            ThisCanBeCalledOnAnyThread();
            if (!BrowserHelper.TryGetUri(KeybindingsFwLink, out Uri fwLink))
            {
                // We're providing a constant, known-good link. This should be impossible.
                throw ExceptionUtilities.Unreachable;
            }

            BrowserHelper.StartBrowser(fwLink);

            KeybindingsResetLogger.Log("ExtensionsLink");
            _workspace.Options = _workspace.Options.WithChangedOption(KeybindingResetOptions.NeedsReset, false);
        }
Ejemplo n.º 7
0
        private void ShowGoldBar()
        {
            AssertIsForeground();

            // If the gold bar is already open, do not show
            if (_infoBarOpen)
            {
                return;
            }

            _infoBarOpen = true;

            string message;

            if (_experimentationService.IsExperimentEnabled(InternalFlightName))
            {
                message = ServicesVSResources.We_noticed_you_suspended_ReSharper_Ultimate_Restore_Visual_Studio_keybindings_to_continue_to_navigate_and_refactor;
            }
            else if (_experimentationService.IsExperimentEnabled(ExternalFlightName))
            {
                message = ServicesVSResources.Your_keybindings_are_no_longer_mapped_to_Visual_Studio_commands;
            }
            else
            {
                // Should never have gotten to checking this if one of the flights isn't enabled.
                throw ExceptionUtilities.Unreachable;
            }

            KeybindingsResetLogger.Log("InfoBarShown");
            var infoBarService = _workspace.Services.GetRequiredService <IInfoBarService>();

            infoBarService.ShowInfoBarInGlobalView(
                message,
                new InfoBarUI(title: ServicesVSResources.Restore_Visual_Studio_keybindings,
                              kind: InfoBarUI.UIKind.Button,
                              action: RestoreVsKeybindings),
                new InfoBarUI(title: ServicesVSResources.Use_Keybindings_for_extensions,
                              kind: InfoBarUI.UIKind.Button,
                              action: OpenExtensionsHyperlink),
                new InfoBarUI(title: ServicesVSResources.Never_show_this_again,
                              kind: InfoBarUI.UIKind.HyperLink,
                              action: NeverShowAgain),
                new InfoBarUI(title: "", kind: InfoBarUI.UIKind.Close,
                              action: InfoBarClose));
        }
Ejemplo n.º 8
0
        private void RestoreVsKeybindings()
        {
            AssertIsForeground();

            if (_uiShell == null)
            {
                _uiShell = _serviceProvider.GetService <IVsUIShell, SVsUIShell>();
            }

            ErrorHandler.ThrowOnFailure(_uiShell.PostExecCommand(
                                            VSConstants.GUID_VSStandardCommandSet97,
                                            (uint)VSConstants.VSStd97CmdID.CustomizeKeyboard,
                                            (uint)OLECMDEXECOPT.OLECMDEXECOPT_DODEFAULT,
                                            null));

            KeybindingsResetLogger.Log("KeybindingsReset");

            _workspace.Options = _workspace.Options.WithChangedOption(KeybindingResetOptions.NeedsReset, false);
        }