Event handling

SSharp S# API

DropDown image DropDownHover image Collapse image Expand image CollapseAll image ExpandAll image Copy image CopyHover image

S# has limited capabilities of handling .NET events. However it is possible to subscribe a function defined in Script on .NET event.

Note: It is possible to subscribe on events having the following signature:
 
   public void Event(object sender, T eventArgs) or which is the same EventHandler<T>.

Here's an example for running S# in a simple Windows Forms application:

 
function OnClick(s,e)
{
  MessageBox.Show('Hello');
}
button.Click += OnClick;

 
You can also the sample from here.

It is also possible to wire Routed Events with S# functions when running scripts within WPF or Silverlight applications.