コード例 #1
0
ファイル: MainForm.cs プロジェクト: Hendrik410/KKS_Drone
 private void settingsButton_Click(object sender, EventArgs e)
 {
     ShowForm(settingsForm, () => (settingsForm = new SettingsForm(drone)));
 }
コード例 #2
0
ファイル: MainForm.cs プロジェクト: Hendrik410/KKS_Drone
 private void settingsButton_Click(object sender, EventArgs e)
 {
     ShowForm(settingsForm, () => (settingsForm = new SettingsForm(drone)));
 }
コード例 #3
0
ファイル: SettingsForm.cs プロジェクト: Hendrik410/KKS_Drone
            public Binding(SettingsForm settings, Control control, string dataMember)
            {
                this.Settings = settings;
                this.Control = control;
                this.DataMember = dataMember;
                this.memberParts = dataMember.Split('.');

                if (control is TextBox)
                {
                    controlProperty = control.GetType().GetProperty("Text");
                    (control as TextBox).TextChanged += (s, e) => UpdateData();
                }
                else if (control is NumericUpDown)
                {
                    controlProperty = control.GetType().GetProperty("Value");
                    (control as NumericUpDown).ValueChanged += (s, e) => UpdateData();
                }
                else if (control is CheckBox)
                {
                    controlProperty = control.GetType().GetProperty("Checked");
                    (control as CheckBox).CheckedChanged += (s, e) => UpdateData();
                }
                else
                    throw new NotSupportedException("Control type not supported");

                NotifyValueChanged();
            }