public void Show(TreeModelBrowserDescriptor browserDescriptor)
        {
            ToolWindowInstance instance = myToolWindowClass.RegisterInstance(
                myLifetime,
                StringUtil.MakeTitle(browserDescriptor.Title.Value), browserDescriptor.Image,
                (lt, twi) => TreeModelBrowserPanelPsiWPF.SelectTreeImplementation(browserDescriptor, lt, myActionBarManager, myLocks, mySettingsStore, myColorThemeManager, myThemedIconManager));

            instance.Lifetime.AddAction(() => browserDescriptor.LifetimeDefinition.Terminate());
            instance.EnsureControlCreated().Show();
        }
예제 #2
0
        public void Show(TreeModelBrowserDescriptor browserDescriptor)
        {
            ToolWindowInstance instance = _toolWindowClass.RegisterInstance(
                _lifetime,
                StringUtil.MakeTitle(browserDescriptor.Title.Value), browserDescriptor.Image,
                (lt, twi) => new TreeModelBrowserPanelPsiWPF(browserDescriptor, lt, _actionBarManager, _environment, _windowsHookManager));

            instance.Lifetime.AddAction(() => browserDescriptor.LifetimeDefinition.Terminate());
            instance.EnsureControlCreated().Show();
        }
예제 #3
0
        public void Show()
        {
            ToolWindowInstance instance = toolWindowClass.RegisterInstance(
                lifetime,
                StringUtil.MakeTitle("YouTrack Explorer"), // title of your window; tip: StringUtil.MakeTitle
                null,                                      // return a System.Drawing.Image to be displayed
                (lt, twi) =>
            {
                var label = new RichTextLabel(application)
                {
                    BackColor = SystemColors.Control, Dock = DockStyle.Fill
                };
                label.RichTextBlock.Add(new RichText("My Content", new TextStyle(FontStyle.Bold)));
                label.RichTextBlock.Parameters = new RichTextBlockParameters(8, ContentAlignment.MiddleCenter);
                return(label.BindToLifetime(lt));
            });

            instance.EnsureControlCreated().Show();
        }
예제 #4
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);
            }
        }