private void Form1_Load(object sender, EventArgs e) { // Create the project. TheProject = new SoftwareProject() { Name = "Priority Events", Status = ReviewStatus.Pending }; // Add some event handlers in mixed up order. TheProject.AddReviewHandler(7, TheProject_ReviewEventHandler); TheProject.AddReviewHandler(3, TheProject_ReviewEventHandler); TheProject.AddReviewHandler(5, TheProject_ReviewEventHandler); }
// The event handler. private void TheProject_ReviewEventHandler( SoftwareProject project, ReviewEventArgs args) { string message = "Priority " + args.Priority.ToString() + "\n\nYes to Approve\nNo to Reject\nCancel for Pending"; switch (MessageBox.Show(message, "Review", MessageBoxButtons.YesNoCancel)) { case DialogResult.Yes: args.Project.Status = ReviewStatus.Approved; break; case DialogResult.No: args.Project.Status = ReviewStatus.Rejected; break; } }