using System;
using System.Windows.Forms;
namespace GUI {
static public class Raiser {
static public event EventHandler<EventArgs> StatusChanged = null;
static public void StateChanged (object sender, EventArgs e) => StatusChanged?.Invoke(sender, e);
}
class Form1 : Form {
private CheckBox chkTest = new CheckBox();
public Form1() {
chkTest.StateChanged += CheckboxStateCghanged;
}
private void CheckboxStateChanged() {
Raiser.StateChanged(this, new CheckboxEventArgs(this.chkTest));
}
}
class CheckboxEventArgs : EventArgs {
public CheckBox CheckBox { get; protected set; }
public CheckBoxEventArgs(CheckBox checkbox) {
this.CheckBox = checkbox;
}
}
}
Comments