/// <summary> /// メンバー設定 /// </summary> /// <param name="member">メンバー</param> /// <param name="value">値</param> /// <param name="memberName">メンバー名(CallerMemberNameで自動設定される)</param> protected void SetMember <T>(ref T member, T value, [CallerMemberName] string memberName = null) { if (Equals(member, value)) { return; } member = value; MemberChanged?.Invoke(this, memberName, value); }
private void IconButton1_Click(object sender, EventArgs e) { var control = new MemberEditControl(_member); control.MemberChanged += (member) => { try { Database.DBContext.CurrentContext.SaveChanges(); } catch { MessageBox.Show("Невозможно сохранить изменения!"); } InitMember(member); MemberChanged?.Invoke(member); }; MainForm.instance.ShowContent(control); }
private void Apply(object sender, EventArgs e) { try { member.Course = int.Parse(outputCourse.Text); member.BirthDay = outputBirthDay.Value; member.Group = outputGroup.Text; member.Name = outputName.Text; member.Surname = outputSurname.Text; member.Phone = outputPhone.Text; member.Email = outputEmail.Text; MemberChanged?.Invoke(member); edited = false; Close(sender, e); } catch { outputCourse.BackColor = Color.Red; } }