示例#1
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     //try to create a person instance
     try
     {
         var person = new Person(txtFirstName.Text, txtLastName.Text, chkHasDriverLicence.Checked, txtEmail.Text);
         PersonCreated?.Invoke(this, person);
     }
     catch (Exception exception) // will catch validation errors and display on messagebox
     {
         MessageBox.Show(exception.Message);
     }
 }
示例#2
0
 public virtual void OnPersonCreated()
 {
     CreateNotification(EventActionType.Created);
     PersonCreated?.Invoke(this, new NewNotificationEventArgs(this));
 }