Пример #1
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();
        }
Пример #2
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);
                });
            });
        }
Пример #3
0
        public TypeInterfaceToolWindowRegistrar(Lifetime lifetime,
                                                ToolWindowManager toolWindowManager,
                                                IActionManager actionManager,
                                                IActionBarManager actionBarManager,
                                                IShortcutManager shortcutManager,
                                                TypeInterfaceToolWindowDescriptor toolWindowDescriptor,
                                                IUIApplication environment,
                                                IWindowsHookManager windowsHookManager)
        {
            _lifetime           = lifetime;
            _actionBarManager   = actionBarManager;
            _environment        = environment;
            _windowsHookManager = windowsHookManager;

            _toolWindowClass = toolWindowManager.Classes[toolWindowDescriptor];
            _toolWindowClass.RegisterEmptyContent(
                lifetime,
                lt =>
            {
                var emptyLabel = new RichTextLabel(environment)
                {
                    BackColor = SystemColors.Control, Dock = DockStyle.Fill
                };
                emptyLabel.RichTextBlock.Add(new RichText("No hierarchies open", new TextStyle(FontStyle.Bold)));
                emptyLabel.RichTextBlock.Add(
                    new RichText("Use " + actionManager.GetHowToExecuteAction(shortcutManager, typeof(BrowseTypeHierarchyAction)), TextStyle.Default));
                emptyLabel.RichTextBlock.Add(new RichText("on a type to see hierarchy", TextStyle.Default));
                emptyLabel.RichTextBlock.Parameters = new RichTextBlockParameters(8, ContentAlignment.MiddleCenter);
                return(emptyLabel.BindToLifetime(lt));
            });
        }
Пример #4
0
        public JetBoxOptionsPage(Lifetime lifetime, IUIApplication environment, ClientFactory clientFactory, JetBoxSettingsStorage jetBoxSettings, JetPopupMenus jetPopupMenus)
            : base(lifetime, environment, PID)
        {
            mySettingsStore = jetBoxSettings.SettingsStore.BindToContextLive(lifetime, ContextRange.ApplicationWide);
            myLifetimes     = new SequentialLifetimes(lifetime);

            myClient           = clientFactory.CreateClient();
            myClient.UserLogin = mySettingsStore.GetValue(JetBoxSettingsAccessor.Login);

            // init UI
            myLoggedPanel = new FlowLayoutPanel {
                Visible = false, AutoSize = true
            };
            myLoggedPanel.Controls.Add(myLoginLabel = new RichTextLabel(environment));
            myLoggedPanel.Controls.Add(new LinkLabel("Logout", Logout, jetPopupMenus));

            myNonLoggedPanel = new FlowLayoutPanel {
                Visible = false, AutoSize = true, FlowDirection = FlowDirection.TopDown
            };
            myNonLoggedPanel.Controls.Add(new LinkLabel("Login", Login, jetPopupMenus)
            {
                Image      = Environment.Theming.Icons[UnnamedThemedIcons.Dropbox.Id].CurrentGdipBitmapNotSure(),
                ImageAlign = ContentAlignment.MiddleLeft,
                Padding    = new Padding(20, 0, 0, 0)
            });

            Controls.Add(myLoggedPanel);
            Controls.Add(myNonLoggedPanel);

            InitLoginState();
        }
Пример #5
0
        public JetBoxOptionsPage(Lifetime lifetime, IUIApplication environment, ClientFactory clientFactory, JetBoxSettingsStorage jetBoxSettings, JetPopupMenus jetPopupMenus)
            : base(lifetime, environment, PID)
        {
            mySettingsStore = jetBoxSettings.SettingsStore.BindToContextLive(lifetime, ContextRange.ApplicationWide);
              myLifetimes = new SequentialLifetimes(lifetime);

              myClient = clientFactory.CreateClient();
              myClient.UserLogin = mySettingsStore.GetValue(JetBoxSettingsAccessor.Login);

              // init UI
              myLoggedPanel = new FlowLayoutPanel { Visible = false, AutoSize = true };
              myLoggedPanel.Controls.Add(myLoginLabel = new RichTextLabel(environment));
              myLoggedPanel.Controls.Add(new LinkLabel("Logout", Logout, jetPopupMenus));

              myNonLoggedPanel = new FlowLayoutPanel { Visible = false, AutoSize = true, FlowDirection = FlowDirection.TopDown };
              myNonLoggedPanel.Controls.Add(new LinkLabel("Login", Login, jetPopupMenus)
              {
            Image = Environment.Theming.Icons[UnnamedThemedIcons.Dropbox.Id].CurrentGdipBitmapScreenDpi,
            ImageAlign = ContentAlignment.MiddleLeft,
            Padding = new Padding(20, 0, 0, 0)
              });

              Controls.Add(myLoggedPanel);
              Controls.Add(myNonLoggedPanel);

              InitLoginState();
        }
Пример #6
0
        public JetBoxOptionsPage(Lifetime lifetime, IUIApplication environment, ClientFactory clientFactory, JetBoxSettingsStorage jetBoxSettings, JetPopupMenus jetPopupMenus, OpensUri opensUri)
            : base(lifetime, environment, PID)
        {
            mySettingsStore = jetBoxSettings.SettingsStore.BindToContextLive(lifetime, ContextRange.ApplicationWide);
            myOpensUri      = opensUri;

            myClient           = clientFactory.CreateClient();
            myClient.UserLogin = mySettingsStore.GetValue(JetBoxSettingsAccessor.Login);

            // init UI
            myLoggedPanel = new FlowLayoutPanel {
                Visible = false, AutoSize = true
            };
            myLoggedPanel.Controls.Add(myLoginLabel = new RichTextLabel(environment));
            myLoggedPanel.Controls.Add(new LinkLabel("Logout", Logout, jetPopupMenus));

            myNonLoggedPanel = new FlowLayoutPanel {
                Visible = false, AutoSize = true, FlowDirection = FlowDirection.TopDown
            };
            myNonLoggedPanel.Controls.Add(new LinkLabel("Login", Login, jetPopupMenus));
            myNonLoggedPanel.Controls.Add(new LinkLabel("Get access (click after approving access on the web)", GetInfo, jetPopupMenus));

            Controls.Add(myLoggedPanel);
            Controls.Add(myNonLoggedPanel);

            InitLoginState();
        }
Пример #7
0
 public ShaderLabFormattingStylePage(Lifetime lifetime,
                                     [NotNull] OptionsSettingsSmartContext smartContext,
                                     [NotNull] IUIApplication environment,
                                     [NotNull] ShaderLabFormattingStylePageSchema schema,
                                     [NotNull] CodeStylePreview preview, IComponentContainer container)
     : base(lifetime, smartContext, environment, schema, preview, container)
 {
 }
Пример #8
0
        public TestCopOptionPage(Lifetime lifetime, OptionsSettingsSmartContext settings, TemplateScopeManager scopeManager
                                 , IThemedIconManager iconManager, IUIApplication application
                                 , StoredTemplatesProvider storedTemplatesProvider, ILiveTemplatesUIHelper templatesUiHelper, FileTemplatesManager fileTemplatesManager, ISolution solution = null)
        {
            _lifetime                = lifetime;
            _settings                = settings;
            _scopeManager            = scopeManager;
            _application             = application;
            _solution                = solution;
            _fileTemplatesManager    = fileTemplatesManager;
            _storedTemplatesProvider = storedTemplatesProvider;
            _templatesUiHelper       = templatesUiHelper;
            _logger = Logger.GetLogger <TestCopOptionPage>();

            InitializeComponent();
            var testFileAnalysisSettings = settings.GetKey <TestFileAnalysisSettings>(SettingsOptimization.DoMeSlowly);

            InitializeComponent();
            BuildTestStrategyCombo(testFileAnalysisSettings);

            //Do this first as it is reference by other display fields
            testClassSuffixTextBox.BindWithRegexMatchesValidation(testFileAnalysisSettings, P(x => x.TestClassSuffix), "^[_a-zA-Z,]*$");

            //Regex Config for Multiple Test Assemply Logic via project naming
            testProjectNameRegExTextBox.BindWithValidationMustBeARegex(testFileAnalysisSettings, P(x => x.TestProjectNameToCodeProjectNameRegEx));
            testProjectNameRegExReplaceTextBox.BindWithRegexMatchesValidation(testFileAnalysisSettings, P(x => x.TestProjectNameToCodeProjectNameRegExReplace), "^[\\$\\.a-zA-Z1-9]*$");

            //Regex Config for Multiple Test Assemply Logic via namespace naming
            testNamespaceRegExTextBox.BindWithValidationMustBeARegex(testFileAnalysisSettings, P(x => x.TestProjectToCodeProjectNameSpaceRegEx));
            testNamespaceRegExReplaceTextBox.BindWithRegexMatchesValidation(testFileAnalysisSettings, P(x => x.TestProjectToCodeProjectNameSpaceRegExReplace), "^[\\$\\.a-zA-Z1-9]*$");
            //
            //Regex Config for Single Test Assemply Logic
            SingleTestNamespaceRegExTextBox.BindWithValidationMustBeARegex(testFileAnalysisSettings, P(x => x.SingleTestRegexTestToAssembly));
            SingleTestNamespaceToAssemblyRegExReplaceTextBox.BindWithRegexMatchesValidation(testFileAnalysisSettings, P(x => x.SingleTestRegexTestToAssemblyProjectReplace), "^[\\$\\.a-zA-Z1-9]*$");
            SingleTestNamespaceToAssemblySubNameSpaceRegExReplaceTextBox.BindWithRegexMatchesValidation(testFileAnalysisSettings, P(x => x.SingleTestRegexTestToAssemblyProjectSubNamespaceReplace), "^[\\$\\.a-zA-Z1-9]*$");
            SingleTestCodeNamespaceRegExTextBox.BindWithValidationMustBeARegex(testFileAnalysisSettings, P(x => x.SingleTestRegexCodeToTestAssembly));
            SingleTestCodeNamespaceToTestRegExReplaceTextBox.BindWithRegexMatchesValidation(testFileAnalysisSettings, P(x => x.SingleTestRegexCodeToTestReplace), "^[\\$\\.a-zA-Z1-9]*$");
            //
            testFileAnalysisSettings.TestingAttributes().ForEach(p => testingAttributesListBox.Items.Add(p));
            testFileAnalysisSettings.BddPrefixes().ForEach(p => contextPrefixesListBox.Items.Add(p));

            OrphanedFilesPatternsTextBox.Text = testFileAnalysisSettings.OrphanedFilesPatterns;

            BindWithValidationMustBeAFileTemplate(testFileAnalysisSettings, codeTemplateTextBox, P(x => x.CodeFileTemplateName));
            BindWithValidationMustBeAFileTemplate(testFileAnalysisSettings, unitTestTemplateTextBox, P(x => x.UnitTestFileTemplateName));

            ShowAllTestsWithUsageCheckBox.IsChecked   = testFileAnalysisSettings.FindAnyUsageInTestAssembly;
            CheckTestNamespaces.IsChecked             = testFileAnalysisSettings.CheckTestNamespaces;
            CheckSearchForOrphanedCodeFiles.IsChecked = testFileAnalysisSettings.FindOrphanedProjectFiles;
            SupportRenameRefactor.IsChecked           = testFileAnalysisSettings.SupportRenameRefactor;

            OutputPanelOpenOnKeyboardMapping.IsChecked = testFileAnalysisSettings.OutputPanelOpenOnKeyboardMapping;

            TestCopLogoImage.Source =
                (ImageSource) new BitmapToImageSourceConverter().Convert(
                    iconManager.Icons[UnnamedThemedIcons.Agent64x64.Id].CurrentGdipBitmap96, null, null, null);
        }
Пример #9
0
        public HomeWindow(Lifetime lifetime, TutorialWindowManager windowManager,
                          IShellLocks shellLocks, IUIApplication environment, IActionManager actionManager,
                          TabbedToolWindowClass toolWindowClass, IWindowsHookManager windowsHookManager,
                          IColorThemeManager colorThemeManager)
        {
            _windowManager     = windowManager;
            _lifetime          = lifetime;
            _shellLocks        = shellLocks;
            _colorThemeManager = colorThemeManager;
            _toolWindowClass   = toolWindowClass;
            _htmlGenerator     = new HtmlGenerator(lifetime, colorThemeManager);

            var toolWindowInstance = _toolWindowClass.RegisterInstance(
                lifetime, null, null,
                (lt, twi) =>
            {
                twi.QueryClose.Value = true;

                var containerControl = new TutorialPanel(environment).BindToLifetime(lt);

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

                var webControlHandler = new WebBrowserHostUiHandler(viewControl)
                {
                    Flags = HostUIFlags.DPI_AWARE,
                    IsWebBrowserContextMenuEnabled = false
                };

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

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

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

                _htmlMediator = new HtmlMediator(lifetime, this);

                _colorThemeManager.ColorThemeChanged.Advise(lifetime, RefreshKeepContent);

                SetColors();

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

            toolWindowInstance.Title.Value = "Home";
        }
Пример #10
0
 public SourceCodeNavigator(Lifetime lifetime, ISolution solution, IPsiFiles psiFiles,
                            TextControlManager textControlManager, IShellLocks shellLocks,
                            IEditorManager editorManager, DocumentManager documentManager, IUIApplication environment)
 {
     _lifetime           = lifetime;
     _solution           = solution;
     _psiFiles           = psiFiles;
     _textControlManager = textControlManager;
     _shellLocks         = shellLocks;
     _documentManager    = documentManager;
     _environment        = environment;
     _editorManager      = editorManager;
 }
Пример #11
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(); });
        }
        public YouTrackExplorerWindowRegistrar(Lifetime lifetime, ToolWindowManager toolWindowManager,
        YouTrackExplorerWindowDescriptor descriptor, IUIApplication application)
        {
            this.lifetime = lifetime;
              this.application = application;

              toolWindowClass = toolWindowManager.Classes[descriptor];
              toolWindowClass.RegisterEmptyContent(
              lifetime,
              lt =>
              {
            // initialize the default ('empty') content for the tool window
            var label = new RichTextLabel(application) { BackColor = SystemColors.Control, Dock = DockStyle.Fill };
            label.RichTextBlock.Add(new RichText("Nothing Here", new TextStyle(FontStyle.Bold)));
            label.RichTextBlock.Parameters = new RichTextBlockParameters(8, ContentAlignment.MiddleCenter);
            return label.BindToLifetime(lt);
              });
        }
        public ExternalCodeOptionsPage(
            IUIApplication environment,
            OptionsSettingsSmartContext settings,
            Lifetime lifetime,
            IShellLocks shellLocks,
            IWindowsHookManager windowsHookManager,
            FormValidators formValidators,
            IMainWindow mainWindow = null)
            : base(lifetime, environment, Pid)
        {
            _settings           = settings;
            _lifetime           = lifetime;
            _windowsHookManager = windowsHookManager;
            _formValidators     = formValidators;
            _mainWindow         = mainWindow;

            InitControls();
            shellLocks.QueueRecurring(lifetime, "Force settings merge", TimeSpan.FromMilliseconds(300.0), () => OnOk());
        }
        public ExternalCodeOptionsPage(
            IUIApplication environment,
            OptionsSettingsSmartContext settings,
            Lifetime lifetime,
            IShellLocks shellLocks,
            IWindowsHookManager windowsHookManager,
            FormValidators formValidators,
            IMainWindow mainWindow = null)
            : base(lifetime, environment, Pid)
        {
            _settings = settings;
            _lifetime = lifetime;
            _windowsHookManager = windowsHookManager;
            _formValidators = formValidators;
            _mainWindow = mainWindow;

            InitControls();
            shellLocks.QueueRecurring(lifetime, "Force settings merge", TimeSpan.FromMilliseconds(300.0), () => OnOk());
        }
Пример #15
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);
            });
        }
Пример #16
0
        public Checker(Lifetime lifetime, TutorialStep step, ISolution solution, IPsiFiles psiFiles,
                       TextControlManager textControlManager, IShellLocks shellLocks,
                       IEditorManager editorManager, DocumentManager documentManager, IActionManager actionManager,
                       IUIApplication environment)
        {
            _lifetime           = lifetime;
            _currentStep        = step;
            _solution           = solution;
            _psiFiles           = psiFiles;
            _textControlManager = textControlManager;
            _shellLocks         = shellLocks;
            _documentManager    = documentManager;
            _environment        = environment;
            _editorManager      = editorManager;
            _actionManager      = actionManager;

            _stepActionChecker = new StepActionChecker(lifetime, shellLocks, psiFiles, actionManager);
            _stepPsiChecker    = new StepPsiChecker(lifetime, solution, psiFiles, textControlManager, shellLocks, editorManager,
                                                    documentManager, environment);
            _stepNavigationChecker = new StepNavigationChecker(lifetime, solution, psiFiles, textControlManager, shellLocks, editorManager, documentManager, environment);
        }
Пример #17
0
        public YouTrackExplorerWindowRegistrar(Lifetime lifetime, ToolWindowManager toolWindowManager,
                                               YouTrackExplorerWindowDescriptor descriptor, IUIApplication application)
        {
            this.lifetime    = lifetime;
            this.application = application;

            toolWindowClass = toolWindowManager.Classes[descriptor];
            toolWindowClass.RegisterEmptyContent(
                lifetime,
                lt =>
            {
                // initialize the default ('empty') content for the tool window
                var label = new RichTextLabel(application)
                {
                    BackColor = SystemColors.Control, Dock = DockStyle.Fill
                };
                label.RichTextBlock.Add(new RichText("Nothing Here", new TextStyle(FontStyle.Bold)));
                label.RichTextBlock.Parameters = new RichTextBlockParameters(8, ContentAlignment.MiddleCenter);
                return(label.BindToLifetime(lt));
            });
        }
Пример #18
0
        public StepPsiChecker(Lifetime lifetime, ISolution solution, IPsiFiles psiFiles,
                              TextControlManager textControlManager, IShellLocks shellLocks,
                              IEditorManager editorManager, DocumentManager documentManager, IUIApplication environment)
        {
            _lifetime           = lifetime;
            _solution           = solution;
            _psiFiles           = psiFiles;
            _textControlManager = textControlManager;
            _shellLocks         = shellLocks;
            _documentManager    = documentManager;
            _environment        = environment;
            _editorManager      = editorManager;

            Action <ITreeNode, PsiChangedElementType> psiChanged =
                (_, __) => OnPsiChanged();

            _lifetime.AddBracket(
                () => psiFiles.AfterPsiChanged += psiChanged,
                () => psiFiles.AfterPsiChanged -= psiChanged);

            AfterPsiChangesDone = new Signal <bool>(lifetime, "StepPsiChecker.AfterPsiChangesDone");
        }
Пример #19
0
        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();
        }
Пример #20
0
        public JetBoxOptionsPage(Lifetime lifetime, IUIApplication environment, ClientFactory clientFactory, JetBoxSettingsStorage jetBoxSettings, JetPopupMenus jetPopupMenus, OpensUri opensUri)
            : base(lifetime, environment, PID)
        {
            mySettingsStore = jetBoxSettings.SettingsStore.BindToContextLive(lifetime, ContextRange.ApplicationWide);
              myOpensUri = opensUri;

              myClient = clientFactory.CreateClient();
              myClient.UserLogin = mySettingsStore.GetValue(JetBoxSettingsAccessor.Login);

              // init UI
              myLoggedPanel = new FlowLayoutPanel { Visible = false, AutoSize = true };
              myLoggedPanel.Controls.Add(myLoginLabel = new RichTextLabel(environment));
              myLoggedPanel.Controls.Add(new LinkLabel("Logout", Logout, jetPopupMenus));

              myNonLoggedPanel = new FlowLayoutPanel { Visible = false, AutoSize = true, FlowDirection = FlowDirection.TopDown };
              myNonLoggedPanel.Controls.Add(new LinkLabel("Login", Login, jetPopupMenus));
              myNonLoggedPanel.Controls.Add(new LinkLabel("Get access (click after approving access on the web)", GetInfo, jetPopupMenus));

              Controls.Add(myLoggedPanel);
              Controls.Add(myNonLoggedPanel);

              InitLoginState();
        }
 public AsyncSuffixOptionsPage([NotNull] Lifetime lifetime, [NotNull] OptionsSettingsSmartContext store,
     IWindowsHookManager windowsHookManager, FormValidators formValidators, IUIApplication iuiApplication)
     : base(lifetime, store)
 {
     AddHeader("Tests");
     AddBoolOption(
         (AsyncSuffixSettings options) => options.ExcludeTestMethodsFromAnalysis,
         "Exclude test methods from analysis");
     var editItemViewModelFactory = new DefaultCollectionEditItemViewModelFactory(null);
     var buttonProviderFactory = new DefaultButtonProviderFactory(lifetime, windowsHookManager, formValidators,
         iuiApplication, editItemViewModelFactory);
     var customAsyncTypes = new StringCollectionEditViewModel(lifetime, "Treat these types as async:",
         buttonProviderFactory, editItemViewModelFactory);
     store.EnumEntryIndices(AsyncSuffixSettingsAccessor.CustomAsyncTypes)
         .ToArray()
         .ForEach(x => customAsyncTypes.AddItem(x));
     customAsyncTypes.Items.CollectionChanged += (o, e) =>
     {
         foreach (
             var entryIndex in
                 OptionsSettingsSmartContext.EnumEntryIndices(AsyncSuffixSettingsAccessor.CustomAsyncTypes)
                     .ToArray())
         {
             OptionsSettingsSmartContext.RemoveIndexedValue(AsyncSuffixSettingsAccessor.CustomAsyncTypes,
                 entryIndex);
         }
         foreach (
             var editItemViewModel in
                 customAsyncTypes.Items)
         {
             OptionsSettingsSmartContext.SetIndexedValue(AsyncSuffixSettingsAccessor.CustomAsyncTypes,
                 editItemViewModel.PresentableName, editItemViewModel.PresentableName);
         }
     };
     AddHeader("Custom types");
     AddCustomOption(customAsyncTypes);
 }
Пример #22
0
        public StepNavigationChecker(Lifetime lifetime, ISolution solution, IPsiFiles psiFiles,
                                     TextControlManager textControlManager, IShellLocks shellLocks,
                                     IEditorManager editorManager, DocumentManager documentManager, IUIApplication environment)
        {
            _lifetime           = lifetime;
            _solution           = solution;
            _psiFiles           = psiFiles;
            _textControlManager = textControlManager;
            _shellLocks         = shellLocks;
            _documentManager    = documentManager;
            _environment        = environment;
            _editorManager      = editorManager;

            EventHandler caretMoved = (sender, args) =>
            {
                _shellLocks.QueueReadLock(_lifetime, "StepNavigationChecker.CheckOnCaretChange", CheckCode);
            };

            _lifetime.AddBracket(
                () => textControlManager.Legacy.CaretMoved += caretMoved,
                () => textControlManager.Legacy.CaretMoved -= caretMoved);

            AfterNavigationDone = new Signal <bool>(lifetime, "StepNavigationChecker.AfterNavigationDone");
        }
Пример #23
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));
                }
            }
        }
Пример #24
0
        public CustomDictionariesOptionsPage([NotNull] Lifetime lifetime, OptionsSettingsSmartContext settingsSmartContext, IUIApplication environment)
            : base(lifetime, environment, PID)
        {
            _settings  = settingsSmartContext;
            _optionsUI = new CustomDictionariesOptionsUI();

            this.Control = _optionsUI;

            RefreshCustomDictionaryList();

            _optionsUI.btnAdd.Click    += BtnAddOnClick;
            _optionsUI.btnEdit.Click   += BtnEditOnClick;
            _optionsUI.btnDelete.Click += BtnDeleteOnClick;

            /*
             * settingsSmartContext.SetBinding<SpellCheckSettings, IEnumerable>(
             *  lifetime, x => (IEnumerable)x.CustomDictionaries, optionsUI.lstCustomDictionaries, ListView.ItemsSourceProperty);
             */
        }
Пример #25
0
        public ResourceOptionsPage([NotNull] Lifetime lifetime, OptionsSettingsSmartContext settingsSmartContext, IUIApplication environment)
            : base(lifetime, environment, PID)
        {
            _settings    = settingsSmartContext;
            _optionsUI   = new ResXOptionsUI();
            this.Control = _optionsUI;

            settingsSmartContext.SetBinding <ResXSettings, string>(
                lifetime, x => x.DictionaryName, _optionsUI.txtDictionaryName, TextBox.TextProperty);
            settingsSmartContext.SetBinding <ResXSettings, string>(
                lifetime, x => x.WordsToIgnore, _optionsUI.txtWordsToIgnore, TextBox.TextProperty);
        }
        public XmlDocumentationGeneralOptionsPage([NotNull] Lifetime lifetime, OptionsSettingsSmartContext settingsSmartContext, IUIApplication environment)
            : base(lifetime, environment, PID)
        {
            _settings    = settingsSmartContext;
            _optionsUI   = new XmlDocumentationOptionsUI();
            this.Control = _optionsUI;

            settingsSmartContext.SetBinding <XmlDocumentationSettings, string>(
                lifetime, x => x.DictionaryName, _optionsUI.txtDictionaryName, TextBox.TextProperty);
            settingsSmartContext.SetBinding <XmlDocumentationSettings, bool?>(
                lifetime, x => x.SuppressIfBaseHasComment, _optionsUI.chkSuppressIfBaseHasComment, CheckBox.IsCheckedProperty);
            settingsSmartContext.SetBinding <XmlDocumentationSettings, int>(
                lifetime, x => x.MaxCharactersPerLine, _optionsUI.txtMaxCharsPerLine, IntegerTextBox.ValueProperty);
            settingsSmartContext.SetBinding <XmlDocumentationSettings, string>(
                lifetime, x => x.WordsToIgnore, _optionsUI.txtWordsToIgnore, TextBox.TextProperty);
            settingsSmartContext.SetBinding <XmlDocumentationSettings, string>(
                lifetime, x => x.WordsToIgnoreForMetatagging, _optionsUI.txtWordsToIgnoreForMetatagging, TextBox.TextProperty);
        }
Пример #27
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);
        }
Пример #28
0
        public StringOptionsPage([NotNull] Lifetime lifetime, OptionsSettingsSmartContext settingsSmartContext, IUIApplication environment)
            : base(lifetime, environment, PID)
        {
            _settings    = settingsSmartContext;
            _optionsUI   = new StringOptionsUI();
            this.Control = _optionsUI;

            settingsSmartContext.SetBinding <StringSettings, string>(
                lifetime, x => x.DictionaryName, _optionsUI.txtDictionaryName, TextBox.TextProperty);
            settingsSmartContext.SetBinding <StringSettings, bool?>(
                lifetime, x => x.IgnoreVerbatimStrings, _optionsUI.chkIgnoreVerbatimStrings, CheckBox.IsCheckedProperty);
            settingsSmartContext.SetBinding <StringSettings, string>(
                lifetime, x => x.WordsToIgnore, _optionsUI.txtWordsToIgnore, TextBox.TextProperty);
        }
        public AgentSmithGeneralPage([NotNull] Lifetime lifetime, OptionsSettingsSmartContext settingsSmartContext, IUIApplication environment)
            : base(lifetime, environment, PID)
        {
            _settings  = settingsSmartContext;
            _optionsUI = new AgentSmithOptionsUI();

            AssemblyName assemblyName = typeof(AgentSmithOptionsPage).Assembly.GetName();

            _optionsUI.txtTitle.Text += assemblyName.Name + " V" + assemblyName.Version;
            Control = _optionsUI;
        }
Пример #30
0
        public TutorialWindow(string contentPath, Lifetime tutorialLifetime, TutorialWindowManager windowManager,
                              ISolution solution, IPsiFiles psiFiles,
                              ChangeManager changeManager, TextControlManager textControlManager, IShellLocks shellLocks,
                              IEditorManager editorManager,
                              DocumentManager documentManager, IUIApplication environment, IActionManager actionManager,
                              TabbedToolWindowClass toolWindowClass,
                              WindowsHookManager windowsHookManager,
                              IColorThemeManager colorThemeManager)
        {
            _windowManager     = windowManager;
            _htmlGenerator     = new HtmlGenerator(tutorialLifetime, colorThemeManager);
            _tutorialLifetime  = tutorialLifetime;
            _shellLocks        = shellLocks;
            _colorThemeManager = colorThemeManager;

            if (!solution.GetComponent <ISolutionOwner>().IsRealSolutionOwner)
            {
                return;
            }

            _toolWindowInstance = toolWindowClass.RegisterInstance(
                tutorialLifetime, null, null,
                (lt, twi) =>
            {
                twi.QueryClose.Value = true;

                var containerControl = new TutorialPanel(environment).BindToLifetime(lt);

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

                var webControlHandler = new WebBrowserHostUiHandler(viewControl)
                {
                    Flags = HostUIFlags.DPI_AWARE,
                    IsWebBrowserContextMenuEnabled = false
                };

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

                lt.AddAction(() => _progressBar = null);

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

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

                _colorThemeManager.ColorThemeChanged.Advise(tutorialLifetime, RefreshKeepContent);

                SetColors();

                _htmlMediator = new HtmlMediator(tutorialLifetime, this);
                _htmlMediator.OnNextStepButtonClick.Advise(tutorialLifetime,
                                                           () => NextStep?.Invoke(null, EventArgs.Empty));
                _htmlMediator.OnRunStepNavigationLinkClick.Advise(tutorialLifetime, NavigateToCodeByLink);

                var focusTracker = new WindowFocusTracker(tutorialLifetime);
                focusTracker.IsFocusOnEditor.Change.Advise(tutorialLifetime,
                                                           () => _htmlMediator.ChangeNextStepButtonText(focusTracker.IsFocusOnEditor.Value));

                _htmlMediator.OnPageHasFullyLoaded.Advise(tutorialLifetime,
                                                          () => { _htmlMediator.ChangeNextStepButtonText(focusTracker.IsFocusOnEditor.Value); });

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

            _stepPresenter = new TutorialStepPresenter(this, contentPath, tutorialLifetime, solution, psiFiles,
                                                       changeManager,
                                                       textControlManager, shellLocks, editorManager, documentManager, environment, actionManager);

            _toolWindowInstance.Title.Value = _stepPresenter.Title;
        }
 public OptionsPage(Lifetime lifetime, IUIApplication environment, OptionsSettingsSmartContext settings)
     : this()
 {
     DataContext = new OptionsViewModel(settings);
 }
Пример #32
0
 public ReflowAndRetagOptionsPage([NotNull] Lifetime lifetime, OptionsSettingsSmartContext settingsSmartContext, IUIApplication environment)
     : base(lifetime, environment, PID)
 {
     _settings    = settingsSmartContext;
     _optionsUI   = new ReflowAndRetagOptionsUI(_settings);
     this.Control = _optionsUI;
 }
Пример #33
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);
            }
        }
Пример #34
0
        public TypeInterfaceDescriptor(ITypeElement typeElement, bool instanceOnly, ISolution solution, IUIApplication uiApplication, ITooltipManager tooltipManager, IWindowsHookManager windowsHookManager, IActionManager actionManager)
            : base(solution, uiApplication, tooltipManager, windowsHookManager, actionManager)
        {
            AutoExpandSingleChild = true;
            myInstanceOnly        = instanceOnly;

            // We use standard presenter, but emphasize root element using adorements
            myPresenter = new TypeInterfacePresenter
            {
                DrawElementExtensions    = true,
                ShowOccurenceCount       = false,
                PostfixTypeQualification = true
            };
            myPresenter.PresentAdorements += PresentAdorements;

            // Wrap typeElement with an envoy, so it can survive code changes
            myTypeElementEnvoy = new DeclaredElementEnvoy <ITypeElement>(typeElement);
            MakeModel();
        }
 public FileAssociationsTreeView(TreeModel model, ITreeViewController controller, IUIApplication environment, ITooltipManager tooltipManager, IWindowsHookManager windowsHookManager, IActionManager actionManager)
     : base(model, controller, environment, tooltipManager, windowsHookManager, actionManager)
 {
 }
Пример #36
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));
                }
            }
        }