示例#1
0
        //--------------------------------------------------------------
        #region Creation & Cleanup
        //--------------------------------------------------------------

        /// <summary>
        /// Initializes a new instance of the <see cref="OutputViewModel" /> class.
        /// </summary>
        /// <param name="editor">The editor. Can be <see langword="null"/> at design-time.</param>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="editor"/> is <see langword="null"/>.
        /// </exception>
        public OutputViewModel(IEditorService editor)
        {
            if (editor == null && !WindowsHelper.IsInDesignMode)
            {
                throw new ArgumentNullException(nameof(editor));
            }

            _editor      = editor;
            DisplayName  = "Output";
            IsPersistent = true;
            DockId       = DockIdString;
            //Icon = MultiColorGlyphs.Output;

            _buffers = new Dictionary <string, StringBuilder>
            {
                { DefaultView, new StringBuilder() }
            };
            Views = new ObservableCollection <string> {
                DefaultView
            };
            PrintPreviewCommand = new DelegateCommand(ShowPrintPreview, CanPrint);
            PrintCommand        = new DelegateCommand(Print, CanPrint);

            _nlogTarget = editor?.Services.GetInstance <INLogTarget>();
            if (_nlogTarget != null)
            {
                _buffers.Add(NLogView, new StringBuilder());
                Views.Add(NLogView);
            }
            _windowService = editor?.Services.GetInstance <IWindowService>().ThrowIfMissing();

            Output = new TextDocument {
                UndoStack = { SizeLimit = 0 }
            };
            SelectedView = DefaultView;
        }
示例#2
0
        //--------------------------------------------------------------
        /// <summary>
        /// Initializes a new instance of the <see cref="OutputViewModel" /> class.
        /// </summary>
        /// <param name="editor">The editor. Can be <see langword="null"/> at design-time.</param>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="editor"/> is <see langword="null"/>.
        /// </exception>
        public OutputViewModel(IEditorService editor)
        {
            if (editor == null && !WindowsHelper.IsInDesignMode)
                throw new ArgumentNullException(nameof(editor));

            _editor = editor;
            DisplayName = "Output";
            IsPersistent = true;
            DockId = DockIdString;
            //Icon = MultiColorGlyphs.Output;

            _buffers = new Dictionary<string, StringBuilder>
            {
                { DefaultView, new StringBuilder() }
            };
            Views = new ObservableCollection<string> { DefaultView };
            PrintPreviewCommand = new DelegateCommand(ShowPrintPreview, CanPrint);
            PrintCommand = new DelegateCommand(Print, CanPrint);

            _nlogTarget = editor?.Services.GetInstance<INLogTarget>();
            if (_nlogTarget != null)
            {
                _buffers.Add(NLogView, new StringBuilder());
                Views.Add(NLogView);
            }
            _windowService = editor?.Services.GetInstance<IWindowService>().ThrowIfMissing();

            Output = new TextDocument { UndoStack = { SizeLimit = 0 } };
            SelectedView = DefaultView;
        }