Re: Unhooking events from Handler

2012-04-01 Thread David Walker
http://msdn.microsoft.com/en-us/library/ee658248.aspx search on the page for 'static event' should find the best ways to do this. Typically the child will unsubscribe itself inside Dispose() On 2 Apr 2012, at 02:21, Stephen Price wrote: > Hey all, > > I've got a Static class that's behaving li

RE: Unhooking events from Handler

2012-04-01 Thread Bill McCarthy
I'd consider holding weak references in the static class |-Original Message- |From: ozdotnet-boun...@ozdotnet.com [mailto:ozdotnet- |boun...@ozdotnet.com] On Behalf Of Stephen Price |Sent: Monday, 2 April 2012 11:21 AM |To: ozDotNet |Subject: Unhooking events from Handler | |Hey all, | |I'

Re: Unhooking events from Handler

2012-04-01 Thread Michael Minutillo
In the past I have done something like this: class Disposable : IDisposable { private readonly Action _action; public Disposable(Action action) { _action = action; } public void Dispose() { _action(); } } public interface IHandle { void Handle(TMessage message); } publ

Re: Unhooking events from Handler

2012-04-01 Thread Stephen Price
Thanks David, yep, that's essentially my problem, but unfortunately I have no idea how many events will be hooked up. Its a status indicator that keeps track of the current loading status. ie Loading, Searching, Normal, etc. (each one being an enum). I wanted to put something into the baseviewmodel

RE: Unhooking events from Handler

2012-04-01 Thread James Chapman-Smith
: ozDotNet Subject: Re: Unhooking events from Handler In the past I have done something like this: class Disposable : IDisposable { private readonly Action _action; public Disposable(Action action) { _action = action; } public void Dispose() { _action(); } } public interface

Re: Unhooking events from Handler

2012-04-01 Thread Stephen Price
mes. > > ** ** > > *From:* ozdotnet-boun...@ozdotnet.com [mailto: > ozdotnet-boun...@ozdotnet.com] *On Behalf Of *Michael Minutillo > *Sent:* Monday, 2 April 2012 11:11 > *To:* ozDotNet > *Subject:* Re: Unhooking events from Handler > > ** ** > > In the past I h

Re: Unhooking events from Handler

2012-04-01 Thread Michael Minutillo
heers. >> >> ** ** >> >> James. >> >> ** ** >> >> *From:* ozdotnet-boun...@ozdotnet.com [mailto: >> ozdotnet-boun...@ozdotnet.com] *On Behalf Of *Michael Minutillo >> *Sent:* Monday, 2 April 2012 11:11 >> *To:* ozDotNet >>

Re: Unhooking events from Handler

2012-04-01 Thread Stephen Price
r solving this problem. I use it myself >>> quite a lot. I think it is perfect for Stephen. >>> >>> ** ** >>> >>> Cheers. >>> >>> ** ** >>> >>> James. >>> >>> ** ** >>> >>> *

Re: Unhooking events from Handler

2012-04-01 Thread Stephen Price
t; ja...@chapman-smith.com> wrote: >>> >>>> Hi Michael, >>>> >>>> ** ** >>>> >>>> This is an awesome pattern for solving this problem. I use it myself >>>> quite a lot. I think it is perfect for Stephen. >>&g

Re: Unhooking events from Handler

2012-04-01 Thread Michael Minutillo
; >>>> Thanks! >>>> >>>> On Mon, Apr 2, 2012 at 10:37 AM, James Chapman-Smith < >>>> ja...@chapman-smith.com> wrote: >>>> >>>>> Hi Michael, >>>>> >>>>> ** ** >>>>