Click here to Skip to main content
15,892,575 members
Articles / Programming Languages / C#

Smoothy Event Log Viewer 1.2

Rate me:
Please Sign up or sign in to vote.
4.75/5 (42 votes)
7 Oct 2006Ms-PL4 min read 186.6K   7.4K   119  
MDI event log viewer with quick filter and search capabilities.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using SmoothyInterface.Properties;
using SmoothyInterface.Enum;

namespace SmoothyInterface.Forms
{
	public partial class Options : Form
	{
		public Options()
		{
			InitializeComponent();
		}

		private void Options_Load(object sender, EventArgs e)
		{
			FillVisualStyle();			
		}

		private void FillVisualStyle()
		{
			cbEventDistinction.Items.Clear();

			string[] names = System.Enum.GetNames(typeof(VisualEventDistinctionType));
			
			for (int i = 0; i < names.Length; i++)
			{
				cbEventDistinction.Items.Add(names[i]);
			}

			cbEventDistinction.SelectedItem = Settings.Default.ColorMode;
		}

		private void btnCancel_Click(object sender, EventArgs e)
		{
			this.Close();
		}

		private void btnOK_Click(object sender, EventArgs e)
		{
			SaveSettings();
			this.Close();
		}

		private void SaveSettings()
		{
			Settings.Default.ColorMode = cbEventDistinction.SelectedItem.ToString();
			Settings.Default.Save();
		}

		private void ShowColorDialogForRows(ref Panel panel)
		{
			colorDialog.Color = panel.BackColor;

			if (colorDialog.ShowDialog() == DialogResult.OK)
			{
				panel.BackColor = colorDialog.Color;
			}
		}

		private void btnChooseInformation_Click(object sender, EventArgs e)
		{
			ShowColorDialogForRows(ref panelColourInformation);
		}

		private void btnChooseWarning_Click(object sender, EventArgs e)
		{
			ShowColorDialogForRows(ref panelColorWarning);
		}

		private void btnChooseError_Click(object sender, EventArgs e)
		{
			ShowColorDialogForRows(ref panelColorError);
		}

		private void btnChooseSucces_Click(object sender, EventArgs e)
		{
			ShowColorDialogForRows(ref panelColorSuccessAudit);
		}

		private void btnFailureAudit_Click(object sender, EventArgs e)
		{
			ShowColorDialogForRows(ref panelColorFailureAudit);
		}
	}
}

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 Microsoft Public License (Ms-PL)


Written By
Web Developer
South Africa South Africa
The author is a software consultant in South Africa, specializing in bespoke software solutions.

Comments and Discussions