コード例 #1
0
ファイル: M4uBindableBase.cs プロジェクト: okamura0510/M4u2
        /// <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);
        }
コード例 #2
0
        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);
        }
コード例 #3
0
 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;
     }
 }