EventSubscription in a base class?

Topics: CAB & Smart Client Software Factory
Jul 14, 2006 at 6:36 AM
originally posted by: Mummas

If an EventSubscription is in a base class, will it be invoked for all derived classes.

I created another base Presenter class that derives from the framework's Presenter<>. Views are using this base Presenter. The new base Presenter has an EventSubscription that receives Close event message and respond by removing the View from the work item's smartpart collection and then closing the view (using CloseView).

The EventSubscription does not seem to be called for all the derived Presenter classes that derive from this base Presenter. Is this not possible? How?
Jul 14, 2006 at 11:43 AM
originally posted by: Mummas

The Event subscription is being called for all objects whose class derives from the base class, when the subscription is in the base class.

But I found that the CloseView does not delete the View or the presenter! Breakpoints in the dispose methods are not hit on CloseView. They are hit during when closing the app and the DeckWorkspace dispose is called.

What do we need to delete the View/Presenter objects?
Jul 14, 2006 at 11:46 AM
originally posted by: Mummas

On other point, since the Presenters are not getting destroyed on CloseView, they continue to receive the EventSubscriptions!
Jul 14, 2006 at 7:29 PM
originally posted by: askew

Are you using the EventSubscription to close all the views?
Jul 15, 2006 at 3:07 AM
originally posted by: Mummas

Yes. The EventSubscription code in the base presenter class calls CloseView.

Other observations:
1. It looks like the CloseView only closes the SmartPart in the Workspace. It is still alive in the WorkItem's Smartparts collection.

So esstentially it becomes a hidden View. But the View and its Presenter continue to receive Event Subscriptions.

2. How can the View and Presenter know that they are either Hidden or Closed in the Workspace? This will help filter out events they don't need to respond to.

3. How can we dispose a View entirely? We need not accumulate Views in certain cases, and would like to reclaim memory.