Requesting Information with Events
Events have multiple purposes. Not only do they notify someone that someone occurred, but they can also be used to request information. This requires that the event argument that you are using has a writable property. For instance, suppose there was this event argument:
public class DataEventArgs
{
public object Data
{
get { return _data; }
set { _data = value; }
}
}
An event can expose this event argument. Whoever consumes some object's event with this event argument can write to this property value, as such:
private void MyObject_RequestData(object sender, DataEventArgs e)
{
if (_someCondition)
e.Data = "Yes";
else
e.Data = "No";
}
This way, the data is passed back to the caller, thereby allowing the event to request information. However, this requires that someone consumes it. The key is to have a default if no one consumes it, though in your situation you most likely will consume it (because its your application).