public void Create(int instanceId)
        {
            var evaluator = CreateInteractiveEvaluator(_vsServiceProvider, _classifierAggregator, _contentTypeRegistry, _vsWorkspace);

            Debug.Assert(this._vsInteractiveWindow == null);

            // ForceCreate means that the window should be created if the persisted layout indicates that it is visible.
            _vsInteractiveWindow = _vsInteractiveWindowFactory.Create(Id, instanceId, Title, evaluator, __VSCREATETOOLWIN.CTW_fForceCreate);
            _vsInteractiveWindow.SetLanguage(LanguageServiceGuid, evaluator.ContentType);

            var window = _vsInteractiveWindow.InteractiveWindow;

            window.TextView.Options.SetOptionValue(DefaultTextViewHostOptions.SuggestionMarginId, true);

            EventHandler closeEventDelegate = null;

            closeEventDelegate = (sender, e) =>
            {
                window.TextView.Closed -= closeEventDelegate;
                InteractiveWindow.InteractiveWindow intWindow = window as InteractiveWindow.InteractiveWindow;
                LogCloseSession(intWindow.LanguageBufferCounter);

                evaluator.Dispose();
            };

            // the tool window now owns the engine:
            window.TextView.Closed += closeEventDelegate;
            // vsWindow.AutoSaveOptions = true;

            // fire and forget:
            window.InitializeAsync();

            LogSession(LogMessage.Window, LogMessage.Create);
        }
Exemplo n.º 2
0
        public void Create(int instanceId)
        {
            var evaluator = CreateInteractiveEvaluator(_vsServiceProvider, _classifierAggregator, _contentTypeRegistry, _vsWorkspace);

            Debug.Assert(_vsInteractiveWindow == null);

            // ForceCreate means that the window should be created if the persisted layout indicates that it is visible.
            _vsInteractiveWindow = _vsInteractiveWindowFactory.Create(Id, instanceId, Title, evaluator, __VSCREATETOOLWIN.CTW_fForceCreate);
            _vsInteractiveWindow.SetLanguage(LanguageServiceGuid, evaluator.ContentType);

            if (_vsInteractiveWindow is ToolWindowPane interactiveWindowPane)
            {
                evaluator.OnBeforeReset += is64bit => interactiveWindowPane.Caption = Title + (is64bit ? " (64-bit)" : " (32-bit)");
            }

            var window = _vsInteractiveWindow.InteractiveWindow;

            window.TextView.Options.SetOptionValue(DefaultTextViewHostOptions.SuggestionMarginId, true);

            void closeEventDelegate(object sender, EventArgs e)
            {
                window.TextView.Closed -= closeEventDelegate;
                LogCloseSession(evaluator.SubmissionCount);
                evaluator.Dispose();
            }

            // the tool window now owns the engine:
            window.TextView.Closed += closeEventDelegate;
            // vsWindow.AutoSaveOptions = true;

            // fire and forget:
            window.InitializeAsync();

            LogSession(LogMessage.Window, LogMessage.Create);
        }
Exemplo n.º 3
0
        public void Create(int instanceId)
        {
            var evaluator = CreateInteractiveEvaluator(
                _vsServiceProvider,
                _classifierAggregator,
                _contentTypeRegistry,
                _vsWorkspace
                );

            Debug.Assert(_vsInteractiveWindow == null);

            // ForceCreate means that the window should be created if the persisted layout indicates that it is visible.
            _vsInteractiveWindow = _vsInteractiveWindowFactory.Create(
                Id,
                instanceId,
                Title,
                evaluator,
                __VSCREATETOOLWIN.CTW_fForceCreate
                );
            _vsInteractiveWindow.SetLanguage(LanguageServiceGuid, evaluator.ContentType);

            if (_vsInteractiveWindow is ToolWindowPane interactiveWindowPane)
            {
                evaluator.OnBeforeReset += platform =>
                                           interactiveWindowPane.Caption =
                    Title
                    + platform switch
                {
                    InteractiveHostPlatform.Desktop64
                    => " (.NET Framework " + ServicesVSResources.Bitness64 + ")",
                    InteractiveHostPlatform.Desktop32
                    => " (.NET Framework " + ServicesVSResources.Bitness32 + ")",
                    InteractiveHostPlatform.Core => " (.NET Core)",
                    _ => throw ExceptionUtilities.Unreachable
                };
            }

            var window = _vsInteractiveWindow.InteractiveWindow;

            window.TextView.Options.SetOptionValue(
                DefaultTextViewHostOptions.SuggestionMarginId,
                true
                );

            void closeEventDelegate(object sender, EventArgs e)
            {
                window.TextView.Closed -= closeEventDelegate;
                LogCloseSession(evaluator.SubmissionCount);
                evaluator.Dispose();
            }

            // the tool window now owns the engine:
            window.TextView.Closed += closeEventDelegate;
            // vsWindow.AutoSaveOptions = true;

            // fire and forget:
            window.InitializeAsync();

            LogSession(LogMessage.Window, LogMessage.Create);
        }
        public void Create(int instanceId)
        {
            var evaluator = CreateInteractiveEvaluator(_vsServiceProvider, _classifierAggregator, _contentTypeRegistry, _vsWorkspace);

            Debug.Assert(_vsInteractiveWindow == null);

            // ForceCreate means that the window should be created if the persisted layout indicates that it is visible.
            _vsInteractiveWindow = _vsInteractiveWindowFactory.Create(Id, instanceId, Title, evaluator, __VSCREATETOOLWIN.CTW_fForceCreate);
            _vsInteractiveWindow.SetLanguage(LanguageServiceGuid, evaluator.ContentType);

            var window = _vsInteractiveWindow.InteractiveWindow;
            window.TextView.Options.SetOptionValue(DefaultTextViewHostOptions.SuggestionMarginId, true);

            EventHandler closeEventDelegate = null;
            closeEventDelegate = (sender, e) =>
            {
                window.TextView.Closed -= closeEventDelegate;
                LogCloseSession(evaluator.SubmissionCount);
                evaluator.Dispose();
            };

            // the tool window now owns the engine:
            window.TextView.Closed += closeEventDelegate;
            // vsWindow.AutoSaveOptions = true;

            // fire and forget:
            window.InitializeAsync();

            LogSession(LogMessage.Window, LogMessage.Create);
        }