Re: [Banshee-List] Hyena.Gui.Theatrics.Stage.ActorStep problem



On Mon, Mar 10, 2008 at 3:23 PM, Gabriel Burt <gabriel burt gmail com> wrote:
> I think the issue is that OnActorStep does "return handler (actor);"
>  but this only returns the value from the last delegate in the event's
>  delegate invocation list, so if there are two event handlers, the
>  first one's return value is ignored.

Exactly.

>  On Mon, Mar 10, 2008 at 2:12 PM, Aaron Bockover <abockover novell com> wrote:
>  > You're saying that if a handler has already been registered on the
>  >  event, to throw an exception in the add/remove accessors? Or are you
>  >  saying that only one handler should be allowed to be registered on the
>  >  event?
>  >
>  >  --Aaron

Well, the two options I see are to only allow one handler to be
registered, or to &= the results of all handlers together so that if
any one of them returns false, the actor will expire. One way of
enforcing the number of handlers is to use a property rather than an
event. Another way would be to throw an exception from the event's add
block (which is a weird thing to do, but the dev would defiantly
encounter the exception the first time they tried to run, and it
allows us to continue using the event syntax).

Other options include passing an ActorStepArgs object to the handler
with an Expire property that the handler can set (rather than
returning false), or making the Actor.Expire property settable.

-- 
Scott


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]