Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Unsubscribe all event handler of all events
Message
From
04/05/2009 04:25:33
 
 
To
03/05/2009 04:36:08
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Environment versions
Environment:
C# 3.0
OS:
Windows XP SP2
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01397637
Message ID:
01397724
Views:
35
>Hi,
>Thank you for sharing. It is actually what I am looking for. However, may I know if that is any code change required to subscribe to event after implement WeakEvent and WeakDelegate?

TBH, I've never implemented this pattern in Winforms - I looked at it in WPF which has a WeakEventManager class that does most of the plumbing for you and is already used by the infrastructure for a lot of binding operations (plug for WPF!).

There seem to be several implementations written for Winforms by various people and I've no idea how well any of them work - but I think they all require different code for wiring up events. I'd suggest only implementing this when you *know* there will be a problem - which may well be a lot less often than you first think.

The project loadable at the bottom of this page shows a working example for that implementation: http://blog.codeinreview.com/post/2008/11/27/NET-EVENTS-(Part-3-A-Weak-Solution).aspx

HTH,
Viv
Previous
Reply
Map
View

Click here to load this message in the networking platform