protected override void OnStart(string[] args)
        {
            systemLog = new EventLog("System", ".", "e1iexpress");
            systemLog.EnableRaisingEvents = true;
            handler = new EntryWrittenEventHandler(NetworkEventListener);

            systemLog.EntryWritten += handler;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Extends BeginInvoke so that when a state object is not needed, null does not need to be passed.
        /// <example>
        /// entrywritteneventhandler.BeginInvoke(sender, e, callback);
        /// </example>
        /// </summary>
        public static IAsyncResult BeginInvoke(this EntryWrittenEventHandler entrywritteneventhandler, Object sender, EntryWrittenEventArgs e, AsyncCallback callback)
        {
            if (entrywritteneventhandler == null)
            {
                throw new ArgumentNullException("entrywritteneventhandler");
            }

            return(entrywritteneventhandler.BeginInvoke(sender, e, callback, null));
        }
Ejemplo n.º 3
0
        public BusinessLogic(String psScript, int eventId, string logName, string logSource)
        {
            EventId = eventId;
            OdjLog  = new EventLog(logName, ".", logSource);
            EntryWrittenEventHandler eventHandler = new EntryWrittenEventHandler(EventLog_OnEntryWritten);

            OdjLog.EnableRaisingEvents = true;
            log.Info("Starting Service");
            log.Info("PsScript: " + psScript);
            log.Info("EventId: " + eventId);
            log.Info("LogName: " + logName);
            log.Info("LogSource: " + logSource);
            //Validate Script File existance
            PsScript = Path.GetFullPath(psScript);
            if (!File.Exists(PsScript))
            {
                log.Error("Specified PsScript file('" + PsScript + "') does not exist.");
                //throw new Exception("Specified PsScript file does not exist.");
            }
        }