public void Invoke2() { Events events = new Events(); events.WorkPerformed += Helper.worker_WorkedPerformed; events.WorkCompleted += Helper.worker_WorkedCompleted; events.DoWork(45, WorkType.GoToMeetings); }
public void Invoke1() { Events events = new Events(); events.WorkPerformed += new EventHandler<WorkPerformedEventArgs>(Helper.worker_WorkedPerformed); events.WorkCompleted += new EventHandler(Helper.worker_WorkedCompleted); events.DoWork(10, WorkType.GenerateReports); }
public void Invoke4() { Events events = new Events(); events.WorkPerformed += (s, e) => { Console.WriteLine(e.Hours + " " + e.WorkType); }; events.WorkCompleted += (s, e) => { Console.WriteLine("Worker is done"); }; events.DoWork(8, WorkType.GenerateReports); }
public void Invoke3() { Events events = new Events(); events.WorkPerformed += delegate (object sender, WorkPerformedEventArgs e) { Console.WriteLine(e.Hours + " " + e.WorkType); }; events.WorkCompleted += delegate (object sender, EventArgs e) { Console.WriteLine("Worker is done"); }; events.DoWork(51, WorkType.GoToMeetings); }