public BizBrainAgentSysTrayApp() { //log4net.Config.XmlConfigurator.Configure(); logger = new Logger("BizBrainAgentSysTrayApp"); logger.Log("BizBrainAgentSysTrayApp ctor"); /* if (!EventLog.SourceExists(source)) * { * EventLog.CreateEventSource(source, log); * }*/ // Initialize Tray Icon try { //EventLog.WriteEntry(source,"Before Initialize"); logger.Log("Before Initialize"); bool isAdmin = IsUserAnAdmin(); SetIcon(); MessageBox.Show("Running"); logger.Log("After Initialize"); } catch (Exception e) { logger.Log("Initialize Exception:" + e.Message); logger.Log(e.StackTrace); //EventLog.WriteEntry(source,e.Message); //EventLog.WriteEntry(source,e.StackTrace); Application.Exit(); System.Environment.Exit(0); } if (initialized) { try { SetIcon(); } catch (Exception e) { MessageBox.Show(e.Message); MessageBox.Show(e.StackTrace); logger.Log("SetIcon:" + e.Message); //EventLog.WriteEntry(source, e.Message); //EventLog.WriteEntry(source, e.StackTrace); Application.Exit(); System.Environment.Exit(0); } } }