/*! \brief Raising an event invokes the event handler through a delegate. * * The \b OnMsgDataLoad method also allows derived classes to handle the * event without attaching a delegate. This is the preferred technique for * handling the event in a derived class. * \note When overriding \b OnMsgDataLoad in a derived class, be sure to * call the base class's \b OnMsgDataLoad method so that registered delegates * receive the event. */ protected virtual void OnMsgDataLoad(Wimp.DataLoadMessageEventArgs e) { if (MsgDataLoad != null) { MsgDataLoad(this, e); } }
public void window_DataLoad(object sender, Wimp.DataLoadMessageEventArgs e) { // The sender is the Wimp.Window object. Reporter.WriteLine("Received DataLoad Wimp message:"); Reporter.WriteLine(" Window handle: {0:X8}", e.DataLoad.WindowHandle); Reporter.WriteLine(" Icon handle: {0}", (int)e.DataLoad.IconHandle); Reporter.WriteLine(" Position: {0},{1}", e.DataLoad.Position.X, e.DataLoad.Position.Y); Reporter.WriteLine(" Estimated file size: {0}", e.DataLoad.EstimatedSize); Reporter.WriteLine(" File type: {0:X3}", e.DataLoad.FileType); Reporter.WriteLine(" Filename: {0}", e.DataLoad.FileName); Reporter.WriteLine(""); }
// For a derived class, it is recommended to override the event notifier rather // than subscribe to the event. protected override void OnMsgDataLoad(Wimp.DataLoadMessageEventArgs e) { Reporter.WriteLine("Received DataLoad Wimp message:"); Reporter.WriteLine(" Window handle: {0:X8}", e.DataLoad.WindowHandle); Reporter.WriteLine(" Icon handle: {0}", (int)e.DataLoad.IconHandle); Reporter.WriteLine(" Position: {0},{1}", e.DataLoad.Position.X, e.DataLoad.Position.Y); Reporter.WriteLine(" Estimated file size: {0}", e.DataLoad.EstimatedSize); Reporter.WriteLine(" File type: {0:X3}", e.DataLoad.FileType); Reporter.WriteLine(" Filename: {0}", e.DataLoad.FileName); Reporter.WriteLine(""); // Make sure that other subscribers receive the event (not that there are any). base.OnMsgDataLoad(e); }