IDnSpyWpfTextView CreateTextViewImpl(ITextViewModel textViewModel, ITextViewRoleSet roles, IEditorOptions parentOptions, TextViewCreatorOptions options, Func <IGuidObjectsProvider> createGuidObjectsProvider = null)
        {
            var guidObjectsProvider = new GuidObjectsProvider(options?.CreateGuidObjects, createGuidObjectsProvider?.Invoke());
            var wpfTextView         = new WpfTextView(textViewModel, roles, parentOptions, editorOptionsFactoryService, commandManager, smartIndentationService, formattedTextSourceFactoryService, viewClassifierAggregatorService, textAndAdornmentSequencerFactoryService, classificationFormatMapService, editorFormatMapService, adornmentLayerDefinitionService, lineTransformProviderService, spaceReservationStackProvider, wpfTextViewConnectionListenerServiceProvider, bufferGraphFactoryService, wpfTextViewCreationListeners);

            guidObjectsProvider.WpfTextView = wpfTextView;

            if (options?.MenuGuid != null)
            {
                menuManager.InitializeContextMenu(wpfTextView.VisualElement, options.MenuGuid.Value, guidObjectsProvider, new ContextMenuInitializer(wpfTextView));
            }

            TextViewCreated?.Invoke(this, new TextViewCreatedEventArgs(wpfTextView));

            return(wpfTextView);
        }
Ejemplo n.º 2
0
        IDsWpfTextView CreateTextViewImpl(ITextViewModel textViewModel, ITextViewRoleSet roles, IEditorOptions parentOptions, TextViewCreatorOptions?options)
        {
            var wpfTextView = new WpfTextView(textViewModel, roles, parentOptions, editorOptionsFactoryService, commandService, smartIndentationService, formattedTextSourceFactoryService, viewClassifierAggregatorService, textAndAdornmentSequencerFactoryService, classificationFormatMapService, editorFormatMapService, adornmentLayerDefinitionService, lineTransformProviderService, spaceReservationStackProvider, wpfTextViewConnectionListenerServiceProvider, bufferGraphFactoryService, wpfTextViewCreationListeners, textViewCreationListeners);

            if (!(options?.MenuGuid is null))
            {
                var guidObjectsProvider = new GuidObjectsProvider(wpfTextView, options.CreateGuidObjects);
                menuService.InitializeContextMenu(wpfTextView.VisualElement, options.MenuGuid.Value, guidObjectsProvider, new ContextMenuInitializer(wpfTextView));
            }

            if (options?.EnableUndoHistory != false)
            {
                textViewUndoManagerProvider.Value.GetTextViewUndoManager(wpfTextView);
            }

            TextViewCreated?.Invoke(this, new TextViewCreatedEventArgs(wpfTextView));

            return(wpfTextView);
        }