using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Reflection; using System.Text; using System.Windows.Forms; using System.IO; using log4net; namespace AppLimit.NetSparkle { public partial class NetSparkleMainWindows : Form, IDisposable { private static readonly ILog Log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); public NetSparkleMainWindows() { // init ui InitializeComponent(); } public void Report(String message) { if (lstActions.InvokeRequired) lstActions.Invoke(new Action(Report), message); else { // build the message DateTime c = DateTime.Now; String msg = "[" + c.ToLongTimeString() + "." + c.Millisecond + "] " + message; // report to file ReportToFile(msg); // report the message into ui lstActions.Items.Add(msg); } } private void ReportToFile(String msg) { try { Log.Info(msg); } catch(Exception) { } } #region IDisposable Members void IDisposable.Dispose() { // close the base base.Dispose(); } #endregion } }