|
// Configure log4net using the .config file
[assembly: log4net.Config.XmlConfigurator(Watch=true)]
// This will cause log4net to look for a configuration file
// called ConsoleApp.exe.config in the application base
// directory (i.e. the directory containing ConsoleApp.exe)
namespace uk.org.aspellclark.cooksmate
{
using System;
using System.Reflection;
using System.Windows.Forms;
using log4net;
using uk.org.aspellclark.common;
/// <summary>
/// <name>Program</name>
/// <namespace>uk.org.aspellclark.cooksmate</namespace>
/// <version>1.0</version>
/// <author>Andy Aspell-Clark</author>
/// <description>This is the entry point to the application
/// </description>
/// <history>
/// <historyitem> 1 Jan 2008 1.0 ARAC Initial Version.</historyitem>
/// </history>
/// </summary>
public class Program
{
// Create a logger for use in this class
private static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
// NOTE that using System.Reflection.MethodBase.GetCurrentMethod().DeclaringType
// is equivalent to typeof(Program) but is more portable
// i.e. you can copy the code directly into another class without
// needing to edit the code.
/// <summary>
/// main entry point for the application
/// </summary>
[STAThread]
public static void Main(string[] args)
{
System.Console.WriteLine("\nCooks Mate Starting\n");
// Log an info level message
if (log.IsInfoEnabled) {log.Info("Application [Cooks Mate] Start");}
PreferencesXml prefs = PreferencesXml.GetPreferences(Assembly.GetExecutingAssembly());
prefs.readFromFile();
log.Info("Environment Os ["+SystemInfo.OsVersion+"]");
log.Info("Environment Host ["+SystemInfo.OsHostname+"]");
log.Info("Application Version Number ["+AppVersion.VersionString+"]");
Application.Run(new MainForm(prefs));
}
}
}
|
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.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.