示例#1
0
        internal CodeEditor(
            ICommandManager commandManager
            , IEditorView editorView
            , IEditorViewHost editorViewHost
            , IEditorCommands editorCommands
            , IUndoManager undoManager
            , IFindLogic findLogic
            , CodeOptionsModel codeOptionsModel
            )
        {
            this.commandManager = commandManager;
            this.editorView     = editorView;
            this.editorViewHost = editorViewHost;
            this.findLogic      = findLogic;
            this.editorCommands = editorCommands;
            this.undoManager    = undoManager;
            FrameworkElement element = this.Element;

            element.PreviewLostKeyboardFocus += new KeyboardFocusChangedEventHandler(this.Editor_LostFocus);
            element.LostFocus += new RoutedEventHandler(this.Editor_LostFocus);
            if (this.commandManager != null)
            {
                this.commandManager.CommandExecuting += new CommandExecutionEventHandler(this.Editor_LostFocus);
            }
            this.editorView.Background = Brushes.White;
            TextFormattingRunProperties.DefaultProperties.SetTypeface(new Typeface(FontName));
            TextFormattingRunProperties.DefaultProperties.SetFontRenderingEmSize(FontSize);
            this.editorViewHost.LineNumberGutterForegroundColor = Colors.Black;
            this.editorViewHost.LineNumberGutterTypeface        = new Typeface(FontName);
            this.editorViewHost.LineNumberGutterFontSize        = FontSize;
            this.editorView.Invalidate();
            this.codeOptionsModel = codeOptionsModel;
            this.codeOptionsModel.PropertyChanged += new PropertyChangedEventHandler(this.CodeOptionsModel_PropertyChanged);
            this.UpdateOptions();
        }
示例#2
0
		internal CodeEditor(
			ICommandManager commandManager
			, IEditorView editorView
			, IEditorViewHost editorViewHost
			, IEditorCommands editorCommands
			, IUndoManager undoManager
			, IFindLogic findLogic
			, CodeOptionsModel codeOptionsModel
			)
		{
			this.commandManager = commandManager;
			this.editorView = editorView;
			this.editorViewHost = editorViewHost;
			this.findLogic = findLogic;
			this.editorCommands = editorCommands;
			this.undoManager = undoManager;
			FrameworkElement element = this.Element;
			element.PreviewLostKeyboardFocus += new KeyboardFocusChangedEventHandler(this.Editor_LostFocus);
			element.LostFocus += new RoutedEventHandler(this.Editor_LostFocus);
			if (this.commandManager != null)
			{
				this.commandManager.CommandExecuting += new CommandExecutionEventHandler(this.Editor_LostFocus);
			}
			this.editorView.Background = Brushes.White;
			TextFormattingRunProperties.DefaultProperties.SetTypeface(new Typeface(FontName));
			TextFormattingRunProperties.DefaultProperties.SetFontRenderingEmSize(FontSize);
			this.editorViewHost.LineNumberGutterForegroundColor = Colors.Black;
			this.editorViewHost.LineNumberGutterTypeface = new Typeface(FontName);
			this.editorViewHost.LineNumberGutterFontSize = FontSize;
			this.editorView.Invalidate();
			this.codeOptionsModel = codeOptionsModel;
			this.codeOptionsModel.PropertyChanged += new PropertyChangedEventHandler(this.CodeOptionsModel_PropertyChanged);
			this.UpdateOptions();
		}