public virtual void OnSwitchStateChanged(SwitchStateChangedEventArgs e) { if (SwitchStateChanged != null) { SwitchStateChanged(this, e); SetSwitch((Int16)(e.switchNumber), e.state); } }
private void SwitchStateChanged(object sender, SwitchStateChangedEventArgs e) { switch (e.switchNumber) { case 1: checkBox1.InvokeIfRequired(checkBox1 => { checkBox1.Checked = e.state; }); break; case 2: checkBox2.InvokeIfRequired(checkBox2 => { checkBox2.Checked = e.state; }); break; case 3: checkBox3.InvokeIfRequired(checkBox3 => { checkBox3.Checked = e.state; }); break; case 4: checkBox4.InvokeIfRequired(checkBox4 => { checkBox4.Checked = e.state; }); break; } eqSwitch.SetSwitch((Int16)e.switchNumber, e.state); }