public MainWindow()
        {
            InitializeComponent();

            var simpleMessageFormatter = new SimpleMessageFormatter();

            ListBox listBox = (ListBox)this.FindName("ListBox");

            var listBoxMessageAppender = new ListBoxMessageAppender(simpleMessageFormatter, listBox);
            var fileMessageAppender = new FileMessageAppender(simpleMessageFormatter, "log.txt");

            var messageAppenders = new IMessageAppender[]
            {
                fileMessageAppender,
                listBoxMessageAppender
            };

            this.logger = new Logger(messageAppenders);

            this.KeyDown += MainWindowKeyDown;
        }
Exemple #2
0
        public MainWindow()
        {
            InitializeComponent();

            var simpleMessageFormatter = new SimpleMessageFormatter();

            ListBox listBox = (ListBox)this.FindName("ListBox");

            var listBoxMessageAppender = new ListBoxMessageAppender(simpleMessageFormatter, listBox);
            var fileMessageAppender    = new FileMessageAppender(simpleMessageFormatter, "log.txt");

            var messageAppenders = new IMessageAppender[]
            {
                fileMessageAppender,
                listBoxMessageAppender
            };

            this.logger = new Logger(messageAppenders);

            this.KeyDown += MainWindowKeyDown;
        }