public void OpenOrRestart(IDataContext context, TutorialId id) { var globalOptions = context.GetComponent <GlobalSettings>(); var titleString = TutorialXmlReader.ReadIntro(globalOptions.GetPath(id, PathType.WorkCopyContentFile)); var step = TutorialXmlReader.ReadCurrentStep(globalOptions.GetPath(id, PathType.WorkCopyContentFile)); var firstTime = step == 1; var titleWnd = new TitleWindow(titleString, firstTime); if (titleWnd.ShowDialog() != true) { return; } if (titleWnd.Restart) { SolutionCopyHelper.CopySolution(globalOptions.GetPath(id, PathType.BaseSolutionFolder), globalOptions.GetPath(id, PathType.WorkCopySolutionFolder)); GC.Collect(); TutorialXmlReader.WriteCurrentStep(globalOptions.GetPath(id, PathType.WorkCopyContentFile), "1"); VsCommunication.OpenVsSolution(globalOptions.GetPath(id, PathType.WorkCopySolutionFile)); } else { VsCommunication.OpenVsSolution(globalOptions.GetPath(id, PathType.WorkCopySolutionFile)); } }
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 TutorialStepPresenter(IStepView view, string contentPath, Lifetime lifetime, ISolution solution, IPsiFiles psiFiles, ChangeManager changeManager, TextControlManager textControlManager, IShellLocks shellLocks, IEditorManager editorManager, DocumentManager documentManager, IUIApplication environment, IActionManager actionManager) { _stepView = view; _lifetime = lifetime; Solution = solution; PsiFiles = psiFiles; ChangeManager = changeManager; TextControlManager = textControlManager; ShellLocks = shellLocks; EditorManager = editorManager; DocumentManager = documentManager; Environment = environment; ActionManager = actionManager; _codeNavigator = new SourceCodeNavigator(lifetime, solution, psiFiles, shellLocks, editorManager, documentManager); _steps = new Dictionary <int, TutorialStep>(); var tutorialXmlReader = new TutorialXmlReader(actionManager); _steps = tutorialXmlReader.ReadTutorialSteps(contentPath); Title = TutorialXmlReader.ReadTitle(contentPath); //TODO: get rid of _currentStepId _currentStepId = 1; CurrentStep = _steps[_currentStepId]; _stepView.StepCount = _steps.Count; lifetime.AddBracket( () => { _stepView.NextStep += StepOnStepIsDone; }, () => { _stepView.NextStep -= StepOnStepIsDone; }); ProcessCurrentStep(); }