Click here to Skip to main content
Click here to Skip to main content
Articles » Languages » C# » Applications » Downloads
 
Add your own
alternative version

C# WPF Log4Net Viewer

, 15 Oct 2009 CPOL
Log4Net XML log viewer
LogViewer.zip
LogViewer
bin
Debug
LogViewer.exe
LogViewer.vshost.exe
LogViewer.vshost.exe.manifest
LogViewer.csproj.user
LogViewer.suo
Properties
Settings.settings
Resources
Images
arrow_left.png
arrow_right.png
find.png
Skins
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace LogViewer
{
    /// <summary>
    /// Interaction logic for Filter.xaml
    /// </summary>
    public partial class Filter : Window
    {
        private List<LogEntry> _Entries = null;
        public List<LogEntry> Entries
        {
            get { return _Entries; }
            set { _Entries = value; }
        }

        public string UserName
        {
            get { return this.textBoxUserName.Text; }
        }

        public string Level
        {
            get 
            { 
                if (this.comboBoxLevel.SelectedIndex != -1)
                {
                    return this.comboBoxLevel.SelectedValue.ToString();
                }
                else
                {
                    return string.Empty;
                }
            }
        }

        public string Message
        {
            get { return this.textBoxMessage.Text; }
        }

        public Filter(List<LogEntry> entries)
        {
            Entries = entries;
            InitializeComponent();
            PopulateLevelDropDown();
        }

        private void PopulateLevelDropDown()
        {
            var levels = (from e in Entries select e.Level).Distinct().ToList<string>();
            this.comboBoxLevel.ItemsSource = levels;
        }

        private void buttonClear_Click(object sender, RoutedEventArgs e)
        {
            this.textBoxUserName.Text = string.Empty;
            this.textBoxMessage.Text = string.Empty;
            this.comboBoxLevel.SelectedIndex = -1;
        }

        private void buttonOK_Click(object sender, RoutedEventArgs e)
        {
            this.DialogResult = true;
            this.Close();
        }

        private void buttonCancel_Click(object sender, RoutedEventArgs e)
        {
            this.Close();
        }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Ken C. Len
Software Developer (Senior) LEN Associates Inc.
United States United States
Years of software consulting and software development using Microsoft development products such as Microsoft Content Management System, SQL Server Reporting Service, ASP.Net C# VB.Net, HTML and javascript web development, Visual Studio add-on development, C++ MFC/ATL and COM+ development, and ActiveX components.

| Advertise | Privacy | Mobile
Web02 | 2.8.141015.1 | Last Updated 15 Oct 2009
Article Copyright 2008 by Ken C. Len
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid