public PresentationAssistant(Lifetime lifetime,
                                     ShortcutProvider shortcutProvider,
                                     PresentationAssistantWindowOwner presentationAssistantWindowOwner,
                                     PresentationAssistantSettingsStore settingsStore,
                                     IThreading threading)
        {
            this.shortcutProvider = shortcutProvider;
            this.presentationAssistantWindowOwner = presentationAssistantWindowOwner;
            this.settingsStore = settingsStore;

            // Post to the UI thread so that the app has time to start before we show the message
            threading.ExecuteOrQueue("Presentation Assistant initial message", () =>
            {
                var settings = settingsStore.GetSettings();
                UpdateSettings(!settings.WelcomeMessageShown);
                settings.WelcomeMessageShown = true;
                settingsStore.SetSettings(settings);
            });

            // Post to the UI thread because settings change are raised on a background thread.
            // Has the unfortunate side effect that the action disabling the assistant is shown
            // very briefly, so we blacklist it
            settingsStore.SettingsChanged.Advise(lifetime,
                                                 _ => threading.ExecuteOrQueue("Presentation Assistant update enabled", () => UpdateSettings(true)));
        }
Esempio n. 2
0
        private void OpenEditor(FileAssociation association, Action <EditFileAssociationForm> onClose)
        {
            using (var form = new EditFileAssociationForm(association))
            {
                if (form.ShowDialog(this) != DialogResult.OK)
                {
                    return;
                }

                onClose(form);
                myThreading.ExecuteOrQueue(myLifetime, "ZenCodingOptionPage.UpdateAllNodesPresentation", () => myView.UpdateAllNodesPresentation());
            }
        }
        public void Execute(IDataContext context, DelegateExecute nextExecute)
        {
            var actionGroup = GetMenuActionGroup();

            if (actionGroup == null)
            {
                return;
            }

            var lifetimeDefinition = Lifetimes.Define(lifetime);

            var options = new List <BalloonOption>();

            foreach (var action in GetAvailableActions(actionGroup, context, actionManager))
            {
                var text = GetCaption(action, context, actionManager);
                options.Add(new BalloonOption(text, action));
            }

            agent.ShowBalloon(lifetimeDefinition.Lifetime, "Inspect This", string.Empty,
                              options, new [] { "Done" }, true,
                              balloonLifetime =>
            {
                agent.BalloonOptionClicked.Advise(balloonLifetime, o =>
                {
                    lifetimeDefinition.Terminate();

                    var action = o as IActionDefWithId;
                    threading.ExecuteOrQueue("InspectThisItem", () => action.EvaluateAndExecute(actionManager));
                });

                agent.ButtonClicked.Advise(balloonLifetime, _ => lifetimeDefinition.Terminate());
            });
        }
Esempio n. 4
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);
                });
            });
        }
Esempio n. 5
0
        protected TIDEEvent Create <TIDEEvent>() where TIDEEvent : IDEEvent, new()
        {
            var ideEvent = new TIDEEvent
            {
                KaVEVersion    = _env.KaVEVersion,
                IDESessionUUID = _env.IDESession.UUID,
                TriggeredBy    = CurrentTrigger,
                TriggeredAt    = _dateUtils.Now
            };

            _threading.ExecuteOrQueue(
                "EventGeneratorBase.Create",
                () =>
            {
                ideEvent.ActiveWindow   = DTEActiveWindowName;
                ideEvent.ActiveDocument = DTEActiveDocumentName;
            });

            return(ideEvent);
        }
Esempio n. 6
0
        public void ShowHomeWindow()
        {
            if (_homeWindow != null)
            {
                _homeWindow.Show();
                return;
            }

            _threading.ExecuteOrQueue("RunMainWindow", () =>
            {
                _homeWindow = new HomeWindow(_shellLifetime, this, _shellLocks,
                                             _environment,
                                             _actionManager, _toolWindowClass, _windowsHookManager, _colorThemeManager)
                {
                    PageText = HtmlGenerator.GetResource("HomePage.html")
                };

                _homeWindow.Show();
            });
        }
        protected override bool ExecuteItem(JetPopupMenuItem item)
        {
            var occurence = item.Key as IOccurence;

            using (CommitCookie.Commit(Solution))
            {
                var elementOccurence = occurence as DeclaredElementOccurence;
                if (elementOccurence != null)
                {
                    var validDeclaredElement = elementOccurence.DisplayElement.GetValidDeclaredElement();
                    if (validDeclaredElement != null)
                    {
                        var action = new FindUsagesOfElementAction(validDeclaredElement);
                        threading.ExecuteOrQueue("FindUsagesOfSymbolController",
                                                 () => Lifetimes.Using(lifetime => action.Execute(dataContexts.CreateOnActiveControl(lifetime), () => { })));
                        return(true);
                    }
                }

                return(false);
            }
        }
        private void UpdateHighlighting([NotNull] ITextControl textControl, TextRange expressionRange)
        {
            myThreading.ExecuteOrQueue(ChooserName, () =>
            {
                using (ReadLockCookie.Create())
                {
                    var documentMarkup = myMarkupManager.GetMarkupModel(textControl.Document);
                    foreach (var highlighter in documentMarkup.GetHighlightersEnumerable(HighlightingKey))
                    {
                        documentMarkup.RemoveHighlighter(highlighter);
                        break;
                    }

                    if (expressionRange.IsValid)
                    {
                        documentMarkup.AddHighlighter(
                            HighlightingKey, expressionRange, AreaType.LINES_IN_RANGE, 0,
                            HotspotSessionUi.CURRENT_HOTSPOT_HIGHLIGHTER,
                            ErrorStripeAttributes.Empty, null);
                    }
                }
            });
        }