Пример #1
0
		public VisualAppender() {

			log4net.Repository.ILoggerRepository repository = LogManager.GetRepository();
            
			debugLevel = repository.LevelMap["DEBUG"].Value;
			warningLevel = repository.LevelMap["WARN"].Value;
			infoLevel = repository.LevelMap["INFO"].Value;
			errorLevel = repository.LevelMap["ERROR"].Value;
			fatalLevel = repository.LevelMap["FATAL"].Value;

			logViewModel = new LogViewModel();
		}
Пример #2
0
        public LogView()
        {
            InitializeComponent();

            trimChars = new char[1];
            trimChars[0] = '\n';

            //logTextBox.Document.PageWidth = System.Windows.SystemParameters.PrimaryScreenWidth;
		                       
            Loaded += new RoutedEventHandler((o, e) =>
            {              
                logTextBox.ScrollToEnd();                
            });

            Closing += LogView_Closing;

            VisualAppender visualAppender = (VisualAppender)LogManager.GetRepository().GetAppenders().Single(t => t.Name.Equals("VisualAppender"));
            DataContext = ViewModel = visualAppender.LogViewModel;

            lock (ViewModel.MessagesLock)
            {
                foreach (LogMessageModel message in ViewModel.Messages)
                {
                    addMessage(message);
                }
            }

            ViewModel.Messages.CollectionChanged += messagesCollectionChangedCallback;
            ViewModel.LogLevel.CurrentChanged += LogLevel_CurrentChanged;
     
            using (Stream s = Assembly.GetExecutingAssembly().GetManifestResourceStream("MediaViewer.Logging.LogSyntaxHighlighting.xshd"))
            {
                using (XmlTextReader reader = new XmlTextReader(s))
                {
                    logTextBox.SyntaxHighlighting = HighlightingLoader.Load(reader, HighlightingManager.Instance);
                }
            }
        }