public void run() { Thread.Sleep(500); TrapInfoEventArgs args = new TrapInfoEventArgs(); args.cause = "Shut Down"; OnTrapOccurred(args); }
protected virtual void OnTrapOccurred(TrapInfoEventArgs e) { EventHandler <TrapInfoEventArgs> handler = TrapOccurred; handler.RaiseEvent(this, e); //if (handler != null) //{ // handler(this, e); //} }
public void c_TrapOccurred(object sender, TrapInfoEventArgs e) { Console.WriteLine("<Alert>: cauese/{0}, info/ {1}, ip/{2}, time/{3}", e.cause, e.info, e.ip, DateTime.Now.ToString()); }