示例#1
0
        public void ShowTutorialWindow(int tutorialId, Lifetime lifetime,
                                       ISolution solution, IPsiFiles psiFiles, ChangeManager changeManager, TextControlManager textControlManager,
                                       IShellLocks shellLocks, IEditorManager editorManager, DocumentManager documentManager,
                                       IUIApplication environment,
                                       IActionManager actionManager, WindowsHookManager windowsHookManager, IPsiServices psiServices,
                                       IActionShortcuts shortcutManager, IColorThemeManager colorThemeManager, IThreading threading)
        {
            var contentPath = _globalSettings.GetPath(tutorialId, PathType.WorkCopyContentFile);

            _runningTutorial = tutorialId;

            threading.ExecuteOrQueue("RunTutorialWindow", () =>
            {
                _tutorialWindow = new TutorialWindow(contentPath, lifetime, this, solution, psiFiles, changeManager,
                                                     textControlManager,
                                                     shellLocks, editorManager, documentManager, environment, actionManager, _toolWindowClass,
                                                     windowsHookManager, colorThemeManager);

                lifetime.AddBracket(
                    () =>
                {
                    _tutorialWindow.Show();
                    _homeWindow.HideLoadingImages();
                },
                    () =>
                {
                    _tutorialWindow.Close();
                    _tutorialWindow  = null;
                    _runningTutorial = 0;
                    _homeWindow.EnableButtons(true);
                });
            });
        }
示例#2
0
        public TutorialStepPresenter(IStepView view, string contentPath, Lifetime lifetime, ISolution solution, IPsiFiles psiFiles,
                                     TextControlManager textControlManager, IShellLocks shellLocks, IEditorManager editorManager,
                                     DocumentManager documentManager, IUIApplication environment, IActionManager actionManager,
                                     IPsiServices psiServices, IActionShortcuts shortcutManager)
        {
            _stepView          = view;
            Lifetime           = lifetime;
            Solution           = solution;
            PsiFiles           = psiFiles;
            TextControlManager = textControlManager;
            ShellLocks         = shellLocks;
            EditorManager      = editorManager;
            DocumentManager    = documentManager;
            Environment        = environment;
            ActionManager      = actionManager;
            _contentPath       = contentPath;
            _codeNavigator     = new SourceCodeNavigator(lifetime, solution, psiFiles, textControlManager, shellLocks, editorManager,
                                                         documentManager, environment);
            _steps = new Dictionary <int, TutorialStep>();
            _steps = TutorialXmlReader.ReadTutorialSteps(contentPath);

            _currentStepId = TutorialXmlReader.ReadCurrentStep(contentPath);
            CurrentStep    = _steps[_currentStepId];

            lifetime.AddBracket(
                () => { _stepView.NextStep += GoNext; },
                () => { _stepView.NextStep -= GoNext; });

            ProcessStep();
        }
        public VsCommandShortcutProvider(Lifetime lifetime, ShortcutDisplayStatistics statistics, DTE dte,
                                         IVsCmdNameMapping vsCmdNameMapping,
                                         VsShortcutFinder vsShortcutFinder,
                                         VsToolsOptionsMonitor vsToolsOptionsMonitor,
                                         IActionShortcuts actionShortcuts)
        {
            this.statistics       = statistics;
            this.vsCmdNameMapping = vsCmdNameMapping;
            this.vsShortcutFinder = vsShortcutFinder;
            this.actionShortcuts  = actionShortcuts;
            this.dte = dte;

            cachedActionDefs = new Dictionary <string, CommandBarActionDef>();
            vsToolsOptionsMonitor.VsOptionsMightHaveChanged.Advise(lifetime, _ => cachedActionDefs.Clear());
        }
 public ReSharperActionShortcutProvider(ShortcutDisplayStatistics statistics,
                                        IActionDefs defs,
                                        IActionShortcuts actionShortcuts,
                                        ActionPresentationHelper actionPresentationHelper,
                                        OverriddenShortcutFinder overriddenShortcutFinder,
                                        HotspotSessionExecutor hotspotSessionExecutor,
                                        SettingsStore settingsStore)
 {
     this.statistics               = statistics;
     this.defs                     = defs;
     this.actionShortcuts          = actionShortcuts;
     this.actionPresentationHelper = actionPresentationHelper;
     this.overriddenShortcutFinder = overriddenShortcutFinder;
     this.hotspotSessionExecutor   = hotspotSessionExecutor;
     this.settingsStore            = settingsStore;
 }
示例#5
0
 public SyntheticActionShortcutProvider(ShortcutDisplayStatistics statistics,
                                        IActionShortcuts actionShortcuts)
 {
     this.statistics      = statistics;
     this.actionShortcuts = actionShortcuts;
 }
示例#6
0
        public TutorialWindow(string contentPath, Lifetime lifetime, ISolution solution, IPsiFiles psiFiles,
                              TextControlManager textControlManager, IShellLocks shellLocks, IEditorManager editorManager,
                              DocumentManager documentManager, IUIApplication environment, IActionManager actionManager,
                              ToolWindowManager toolWindowManager, TutorialWindowDescriptor toolWindowDescriptor,
                              IWindowsHookManager windowsHookManager, IPsiServices psiServices, IActionShortcuts shortcutManager,
                              IColorThemeManager colorThemeManager)
        {
            _lifetime          = lifetime;
            _solution          = solution;
            _actionManager     = actionManager;
            _shellLocks        = shellLocks;
            _psiServices       = psiServices;
            _shortcutManager   = shortcutManager;
            _colorThemeManager = colorThemeManager;
            _toolWindowClass   = toolWindowManager.Classes[toolWindowDescriptor];

            if (solution.GetComponent <ISolutionOwner>().IsRealSolutionOwner)
            {
                var toolWindowInstance = _toolWindowClass.RegisterInstance(
                    lifetime, null, null,
                    (lt, twi) =>
                {
                    var containerControl = new TutorialPanel(environment).BindToLifetime(lt);

                    var viewControl = new HtmlViewControl(windowsHookManager, actionManager)
                    {
                        Dock = DockStyle.Fill,
                    }.BindToLifetime(lt);

                    var buttonNext = new Button
                    {
                        Text           = "Next",
                        Anchor         = AnchorStyles.Bottom | AnchorStyles.Right,
                        FlatStyle      = FlatStyle.Flat,
                        FlatAppearance = { BorderColor = Color.Gray, BorderSize = 1 }
                    };

                    lt.AddBracket(
                        () => _buttonNext = buttonNext,
                        () => _buttonNext = null);

                    _buttonNext.Top  = containerControl.Height - _buttonNext.Height - 10;
                    _buttonNext.Left = containerControl.Width - _buttonNext.Width - 25;

                    lt.AddBracket(
                        () => _containerControl = containerControl,
                        () => _containerControl = null);

                    lt.AddBracket(
                        () => _viewControl = viewControl,
                        () => _viewControl = null);

                    lt.AddBracket(
                        () => { _buttonNext.Click += NextStep; },
                        () => { _buttonNext.Click -= NextStep; });

                    lt.AddBracket(
                        () => _containerControl.Controls.Add(_buttonNext),
                        () => _containerControl.Controls.Remove(_buttonNext));

                    lt.AddBracket(
                        () => _containerControl.Controls.Add(_viewControl),
                        () => _containerControl.Controls.Remove(_viewControl));

                    _colorThemeManager.ColorThemeChanged.Advise(lifetime, RefreshKeepContent);

                    SetColors();

                    return(new EitherControl(lt, containerControl));
                });

                _toolWindowClass.QueryCloseInstances.Advise(_lifetime, args => { Close(); });    // not working

                _stepPresenter = new TutorialStepPresenter(this, contentPath, lifetime, solution, psiFiles, textControlManager,
                                                           shellLocks, editorManager, documentManager, environment, actionManager, psiServices, shortcutManager);
            }
        }
示例#7
0
        private static void RunTutorial(string contentPath, Lifetime lifetime, ISolution solution, IPsiFiles psiFiles,
                                        TextControlManager textControlManager, IShellLocks shellLocks, IEditorManager editorManager,
                                        DocumentManager documentManager, IUIApplication environment, IActionManager actionManager,
                                        ToolWindowManager toolWindowManager, TutorialWindowDescriptor tutorialWindowDescriptor,
                                        IWindowsHookManager windowsHookManager, IPsiServices psiServices, IActionShortcuts shortcutManager,
                                        IColorThemeManager colorThemeManager)
        {
            var tutorialWindow = new TutorialWindow(contentPath, lifetime, solution, psiFiles, textControlManager, shellLocks, editorManager,
                                                    documentManager, environment, actionManager, toolWindowManager, tutorialWindowDescriptor, windowsHookManager,
                                                    psiServices, shortcutManager, colorThemeManager);

            lifetime.AddBracket(
                () => { tutorialWindow.Show(); },
                () => { tutorialWindow.Close(); });
        }
示例#8
0
        public TutorialRunner([NotNull] Lifetime lifetime, ISolution solution, IPsiFiles psiFiles,
                              [NotNull] ISolutionStateTracker solutionStateTracker,
                              [NotNull] GlobalSettings globalSettings, TextControlManager textControlManager, IShellLocks shellLocks,
                              IEditorManager editorManager, DocumentManager documentManager, IUIApplication environment,
                              IActionManager actionManager, ToolWindowManager toolWindowManager, TutorialWindowDescriptor tutorialWindowDescriptor,
                              IWindowsHookManager windowsHookManager, IPsiServices psiServices, IActionShortcuts shortcutManager,
                              IColorThemeManager colorThemeManager)
        {
            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 (VsCommunication.GetCurrentSolutionPath() == tutorial.Value)
                {
                    solutionStateTracker.AfterPsiLoaded.Advise(lifetime,
                                                               sol => RunTutorial(globalSettings.GetPath(tutorial.Key, PathType.WorkCopyContentFile), lifetime, solution, psiFiles,
                                                                                  textControlManager, shellLocks, editorManager, documentManager, environment, actionManager, toolWindowManager,
                                                                                  tutorialWindowDescriptor, windowsHookManager, psiServices, shortcutManager, colorThemeManager));
                }
            }
        }
示例#9
0
        private static void RunTutorial(GlobalSettings globalSettings, int tutorialId, Lifetime lifetime,
                                        ISolution solution,
                                        IPsiFiles psiFiles, ChangeManager changeManager, TextControlManager textControlManager,
                                        IShellLocks shellLocks,
                                        IEditorManager editorManager, DocumentManager documentManager, IUIApplication environment,
                                        IActionManager actionManager,
                                        WindowsHookManager windowsHookManager, IPsiServices psiServices, IActionShortcuts shortcutManager,
                                        IColorThemeManager colorThemeManager, IThreading threading)
        {
            if (globalSettings.TutorialWindowManager == null)
            {
                throw new ApplicationException("Expected globalSettings.TutorialWindowManager");
            }

            globalSettings.TutorialWindowManager.ShowTutorialWindow(tutorialId, lifetime, solution, psiFiles,
                                                                    changeManager,
                                                                    textControlManager, shellLocks, editorManager, documentManager, environment, actionManager,
                                                                    windowsHookManager, psiServices, shortcutManager, colorThemeManager, threading);
        }
示例#10
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));
                }
            }
        }