Events are fired but not handled problem

Topics: CAB & Smart Client Software Factory
Dec 22, 2006 at 3:26 AM
originally posted by: RabbiJosephGordon

Scenario:

I have some events on the shell form that I want to make available to all modules. To facilitate this I created a ShellFormController class which subscribes to the specified shell form events and then fires off events of its own.

The events are declared in ShellFormController thus:


EventPublication(EventTopicNames.WindowHiddenEvent, PublicationScope.Global)
public event EventHandler<EventArgs<Control>> WindowHidden;
EventPublication(EventTopicNames.WindowDisplayedEvent, PublicationScope.Global)
public event EventHandler<EventArgs<Control>> WindowDisplayed;

The ShellFormController instance is created in the shell application using:

RootWorkItem.Items.AddNew<FormController>();

In my module, the module controller is interested in these events and so contains handlers like these:

EventSubscription(EventTopicNames.WindowHiddenEvent, Thread = ThreadOption.UserInterface)
private void OnWindowHidden(object sender, EventArgs<Control> e)
{
...
}

EventSubscription(EventTopicNames.WindowDisplayedEvent, Thread = ThreadOption.UserInterface)
private void OnWindowDisplayed(object sender, EventArgs<Control> e)
{
...
}


The Problem:

The events are being fired by the controller but not received by the module handlers. Any ideas, or perhaps a better way of propagating events from the shell form to interested modules.


RJG.
Dec 22, 2006 at 5:11 AM
originally posted by: RabbiJosephGordon

I found the problem. Seems the handlers need to have public access (which I think is a limitation and a liability).


RJG.