View on GitHub

SARAFF SOFTWARE

All products / Saraff.AxHost.NET

Обработка событий. Event Processing.

Для обработки событий необходимо (for the event processing must be):

Объявление и генерация события (C#)

[ApplicationProcessed]
public event EventHandler Uploaded;
if(this.Uploaded!=null) {
    this.Uploaded(this, new UploadEventArgs(_name));
}
public sealed class UploadEventArgs:EventArgs {

    internal UploadEventArgs(string name) {
        this.Name=name;
    }

    public string Name {
        get;
        private set;
    }
}

Обработка события (JavaScript)

<object id="AxHost" 
        name="AxHost"
        classid="clsid:7067A712-CDFD-4780-B6C0-B8F68A9BA84F"
        codebase="Saraff.AxHost.cab"></object>
<script language="javascript" type="text/javascript">
  function AxHost::FireEvent(eventId) {
    switch(eventId.EventName){
      // ...
      case "Uploaded":
        Uploaded(eventId.GetParam("Name"));
        break;
      // ...
    }
  }
</script>

download fullsize image