سؤال

I'm trying to extend my new WPF Touch Screen Keyboard (DLL) Library, to allow the user to get events from the Touch Screen Object. I'd like to be able to tell the Programmer what Object made the call (or executed the subroutine) that raised the event. Not dissimilar to the Sender as Object event parameters one gets when working with a System Object. Which begs the question, How do I get that information, if I don't ask for it? Is there a way to get this information from some call made in the subroutine about to raise the event? That would be nice, and a time saver for me. Thanks!

هل كانت مفيدة؟

المحلول

Can you assign a value to the sender object when you are going to raise the event?

RaiseEvent Touched(Me, e)

نصائح أخرى

You can walk the stack be using the StackTrace class. You will not be able to inspect the call stack parameters, but you can inspect the metadata of the parameters (type information).

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top