Exemplo n.º 1
0
        public TutorialWindowRunner([NotNull] Lifetime lifetime, ISolution solution, IPsiFiles psiFiles,
                                    ChangeManager changeManager, [NotNull] ISolutionStateTracker solutionStateTracker,
                                    [NotNull] GlobalSettings globalSettings, TextControlManager textControlManager, IShellLocks shellLocks,
                                    IEditorManager editorManager, DocumentManager documentManager, IUIApplication environment,
                                    IActionManager actionManager,
                                    WindowsHookManager windowsHookManager, IPsiServices psiServices, IActionShortcuts shortcutManager,
                                    IColorThemeManager colorThemeManager, IThreading threading)
        {
            if (lifetime == null)
            {
                throw new ArgumentNullException("lifetime");
            }
            if (solutionStateTracker == null)
            {
                throw new ArgumentNullException("solutionStateTracker");
            }
            if (globalSettings == null)
            {
                throw new ArgumentNullException("globalSettings");
            }


            foreach (var tutorial in globalSettings.AvailableTutorials)
            {
                if (VsIntegration.GetCurrentSolutionPath() == tutorial.Value)
                {
                    solutionStateTracker.AfterSolutionOpened.Advise(lifetime,
                                                                    () =>
                                                                    RunTutorial(globalSettings, tutorial.Key, lifetime, solution, psiFiles, changeManager,
                                                                                textControlManager, shellLocks, editorManager, documentManager, environment,
                                                                                actionManager, windowsHookManager, psiServices, shortcutManager, colorThemeManager,
                                                                                threading));
                }
            }
        }
Exemplo n.º 2
0
        public void NavigateStep13()
        {
            var dte  = VsIntegration.GetCurrentVsInstance();
            var path = GlobalSettings.Instance.GetPath(4, PathType.WorkCopySolutionFolder) +
                       "\\Tutorial4_WhatsNewReSharper2017.1\\.editorconfig";

            dte.ExecuteCommand("File.OpenFile", path);
        }
Exemplo n.º 3
0
        public static void OpenTutorialSolution(SolutionStateTracker solutionStateTracker, int id)
        {
            var globalSettings = GlobalSettings.Instance;

            VsIntegration.CloseVsSolution();
            solutionStateTracker.NotifyAgreeToRunTutorial();
            SolutionCopyHelper.CleanUpDirectory(globalSettings.GetPath(id, PathType.WorkCopySolutionFolder));
            SolutionCopyHelper.CopySolution(globalSettings.GetPath(id, PathType.BaseSolutionFolder),
                                            globalSettings.GetPath(id, PathType.WorkCopySolutionFolder));
            VsIntegration.OpenVsSolution(globalSettings.GetPath(id, PathType.WorkCopySolutionFile));
        }
Exemplo n.º 4
0
        public void ChangeNextStepButtonText(bool isFocusOnEditor)
        {
            if (!_isButtonTextChangeAllowed)
            {
                return;
            }

            var nextStepShortcut = VsIntegration.GetActionShortcut(GlobalSettings.NextStepShortcutAction);
            var args             = new object[] { isFocusOnEditor, nextStepShortcut };

            _viewControl.Document?.InvokeScript("setNextStepButtonText", args);
        }
Exemplo n.º 5
0
        public TutorialWindowManager(Lifetime shellLifetime, SolutionStateTracker solutionStateTracker,
                                     GlobalSettings globalSettings,
                                     IShellLocks shellLocks, ToolWindowManager toolWindowManager, TutorialWindowDescriptor toolWindowDescriptor,
                                     IUIApplication environment, IActionManager actionManager, IWindowsHookManager windowsHookManager,
                                     IColorThemeManager colorThemeManager, IThreading threading)
        {
            _shellLifetime        = shellLifetime;
            _solutionStateTracker = solutionStateTracker;
            _globalSettings       = globalSettings;
            _shellLocks           = shellLocks;
            _environment          = environment;
            _actionManager        = actionManager;
            _windowsHookManager   = windowsHookManager;
            _colorThemeManager    = colorThemeManager;
            _threading            = threading;

            _runningTutorial = 0;

            _toolWindowClass = toolWindowManager.Classes[toolWindowDescriptor] as TabbedToolWindowClass;
            if (_toolWindowClass == null)
            {
                throw new ApplicationException("Expected tabbed tool window");
            }

            _toolWindowClass.QueryCloseInstances.Advise(shellLifetime, args =>
            {
                if (_runningTutorial == 0)
                {
                    return;
                }
                if (!_tutorialWindow.IsLastStep)
                {
                    args.Cancel = !MessageBox.ShowYesNo(
                        "This will close the tutorial solution as well. Tutorial progress will be lost. Close the tutorial?",
                        "ReSharper Tutorials");
                    if (args.Cancel)
                    {
                        return;
                    }
                }
                VsIntegration.CloseVsSolution(true);
            });
        }
Exemplo n.º 6
0
        public StepActionChecker(Lifetime lifetime, IShellLocks shellLocks, IPsiFiles psiFiles)
        {
            _shellLocks = shellLocks;
            _psiFiles   = psiFiles;
            _vsInstance = VsIntegration.GetCurrentVsInstance();
            var events2 = _vsInstance.Events as Events2;

            if (events2 == null)
            {
                return;
            }

            var commandEvents = events2.CommandEvents;

            lifetime.AddBracket(
                () => commandEvents.AfterExecute += CommandEventsOnAfterExecute,
                () => commandEvents.AfterExecute -= CommandEventsOnAfterExecute);

            OnCheckPass = new Signal <bool>(lifetime, "StepActionChecker.AfterActionApplied");
        }
Exemplo n.º 7
0
        public NextStepShortcutChecker(Lifetime lifetime, TutorialStep step, string nextStepActionName)
        {
            _step = step;
            _nextStepActionName = nextStepActionName;
            _vsInstance         = VsIntegration.GetCurrentVsInstance();
            var events2 = _vsInstance.Events as Events2;

            if (events2 == null)
            {
                return;
            }

            var commandEvents = events2.CommandEvents;

            lifetime.AddBracket(
                () => commandEvents.BeforeExecute += CommandEventsOnBeforeExecute,
                () =>
            {
                commandEvents.BeforeExecute -= CommandEventsOnBeforeExecute;
            });
        }
Exemplo n.º 8
0
 public void CloseSolution()
 {
     VsIntegration.CloseVsSolution(true);
 }
Exemplo n.º 9
0
        public bool CheckStep19()
        {
            var dte = VsIntegration.GetCurrentVsInstance();

            return(dte.ActiveDocument.Name == "GoToText.xml");
        }
Exemplo n.º 10
0
 public void Close(object sender, RoutedEventArgs args)
 {
     VsIntegration.CloseVsSolution(true);
 }