MBrendecke icon

Static Events

MBrendecke | PRO | 12/31/16 09:59:33 AM UTC | 0 ⭐ | 344 👁️ | Never ⏰ | []
C# |

740 B

|

None

|

0 👍

/

0 👎

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