コード例 #1
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));
                }
            }
        }
コード例 #2
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));
            });
        }
コード例 #3
0
 public PresentationAssistantPopupWindowContext(Lifetime lifetime, IActionManager actionManager,
                                                IMainWindow mainWindow, IWindowsHookManager windowsHookManager)
     : base(lifetime, actionManager)
 {
     this.windowsHookManager = windowsHookManager;
     this.mainWindow         = mainWindow;
     Mutex = PopupWindowMutex;
 }
コード例 #4
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";
        }
コード例 #5
0
 public JetPopupMenusInteractivePatched(
     [NotNull] Lifetime lifetime,
     [NotNull] IIsApplicationActiveState isApplicationActiveState,
     [NotNull] IUIApplicationSimple uiapp,
     [NotNull] IAutomationViewsRegistry automationViewsRegistry,
     [CanBeNull, Optional] ITooltipManager tooltipman,
     [CanBeNull, Optional] IWin32Window ownerwin,
     [CanBeNull, Optional] IWindowsHookManager windowsHookManager,
     [CanBeNull, Optional] ISettingsStore settstore,
     [CanBeNull, Optional] PopupWindowManager popupWindowManager)
     : base(lifetime, isApplicationActiveState, uiapp, automationViewsRegistry, tooltipman, ownerwin, windowsHookManager, settstore, popupWindowManager)
 {
 }
コード例 #6
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(); });
        }
コード例 #7
0
        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());
        }
コード例 #8
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);
            });
        }
コード例 #9
0
        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());
        }
コード例 #10
0
        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);
        }
コード例 #11
0
 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);
 }
コード例 #12
0
 public FileAssociationsTreeView(TreeModel model, ITreeViewController controller, IUIApplication environment, ITooltipManager tooltipManager, IWindowsHookManager windowsHookManager, IActionManager actionManager)
     : base(model, controller, environment, tooltipManager, windowsHookManager, actionManager)
 {
 }
コード例 #13
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);
            }
        }
コード例 #14
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();
        }
コード例 #15
0
        public ZenCodingOptionsPage(Lifetime lifetime, OptionsSettingsSmartContext settings, IThreading threading, IThemedIconManager iconManager, UIApplication environment, ITooltipManager tooltipManager, IWindowsHookManager windowsHookManager, IActionManager actionManager)
        {
            myLifetime         = lifetime;
            mySettings         = settings;
            myThreading        = threading;
            myIconManager      = iconManager;
            _environment       = environment;
            myLambdaExpression = s => s.FileAssociations;

            InitializeComponent();

            myFileAssociations = new SortedDictionary <int, FileAssociation>();
            foreach (var pair in mySettings.EnumerateIndexedEntry(myLambdaExpression))
            {
                myFileAssociations[pair.First] = pair.Second;
            }

            var model = BuildModel();

            myView = new FileAssociationsTreeView(model, new FileAssociationViewController(environment), environment, tooltipManager, windowsHookManager, actionManager)
            {
                Presenter = new FileAssociationPresenter(),
                Dock      = DockStyle.Fill
            };
            myView.DoubleClick += EditFileAssociation;
            myRules.Controls.Add(myView);

            _buttons.Items.Add("Create", myIconManager.Icons[ZenCodingCommonThemedIcons.Add.Id].CurrentGdipBitmap96, CreateFileAssociation);
            _buttons.Items.Add("Edit", myIconManager.Icons[CommonThemedIcons.Edit.Id].CurrentGdipBitmap96, EditFileAssociation);
            _buttons.Items.Add("Remove", myIconManager.Icons[CommonThemedIcons.Remove.Id].CurrentGdipBitmap96, RemoveFileAssociation);
            _buttons.Items.Add("Up", myIconManager.Icons[CommonThemedIcons.Up.Id].CurrentGdipBitmap96, MoveUp);
            _buttons.Items.Add("Down", myIconManager.Icons[CommonThemedIcons.Down.Id].CurrentGdipBitmap96, MoveDown);
        }