Re: Overwriting event handler

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Ok. let me explain better

all i want is to change the name of the method in the Eventhandler to my
custom method IF some security criteria are not met. So, when the user
clicks on a button ('cause i want it to be able to be clicked) it will call
the design-time method or my method (which is a Supervisor Form). I can doit
inserting one line of code in every method definition in design time... but
that's a pain when i have more than 200 Forms and every form at least 2
buttons.
So, all i am creating is a base class that is the parent of every form, so i
check in every from that gets loaded its buttons.

I don't think that's something crazy.

Any idea?


"Jon Skeet [C# MVP]" <skeet@xxxxxxxxx> wrote in message
news:MPG.1fe2a352ff69f78498d6d1@xxxxxxxxxxxxxxxxxxxxxxx
Jose Fernandez <ppcuban@xxxxxxxxxxx> wrote:
Well.. maybe this is not the way... but there has to be a way to know who
subscribed to an event in an object.

No, there isn't.

I am gonna try using reflection. There has to be a way.

Why? What makes you think there will definitely be a way? There's no
way of doing it in a totally general way, as events can be implemented
however the author chooses.

Note that even if you can find a way which works for the current
implementation of the classes you're interested in, there's nothing to
stop MS from changing the implementation in the future.

If you want to unsubscribe from events, you'll need to know what the
original subscriptions are. If you're responsible for all the
subscriptions, you can keep track of it yourself. If you're not, it's a
huge breakdown of encapsulation to unsubscribe someone else's handlers
for someone else's events.

--
Jon Skeet - <skeet@xxxxxxxxx>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too


.



Relevant Pages

  • Re: Manage Subscriptions
    ... "As the users themselves subscribe I would also imagine that unsubscribe is ... should be able to choose "Manage Web Subscriptions". ... > also solely under their control. ...
    (microsoft.public.sharepoint.teamservices)
  • [opensuse] Re: Warning: You may have been unsubscribed from the opensuse mailinglists
    ... there was a lists.opensuse.org maintenance process hanging (undetected) ... This had the effect that the list software may have you ... Please check your subscriptions. ... To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx ...
    (SuSE)
  • Re: Looking for software to manage snail-mail subscriptions
    ... Drupal or Joomla) and a module for managing those subscriptions? ... It's hard to just do a web-search for this kind of thing because terms ... list management software, which is much easier to find. ... To UNSUBSCRIBE, email to debian-user-REQUEST@xxxxxxxxxxxxxxxx with a subject of "unsubscribe". ...
    (Debian-User)
  • Re: Looking for software to manage snail-mail subscriptions
    ... Drupal or Joomla) and a module for managing those subscriptions? ... list management software, which is much easier to find. ... To UNSUBSCRIBE, email to debian-user-REQUEST@xxxxxxxxxxxxxxxx ...
    (Debian-User)
  • Re: UNSUBSCRIBE BENJAMIN SHER NOW!!!!!!!!!!!!!!!!!!!!!!!!!!
    ... You have to understand that we cannot unsubscribe you. ... and change your subscriptions here: http://lists.ubuntu.com ... From there you can leave any and all lists on the Ubuntu servers to ... Benjamin Sher wrote: ...
    (Ubuntu)