HighTechTalks DotNet Forums  

Direct Access to VSA project Assembly

Dotnet VSA microsoft.public.dotnet.vsa


Discuss Direct Access to VSA project Assembly in the Dotnet VSA forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
AT
 
Posts: n/a

Default Direct Access to VSA project Assembly - 07-01-2004 , 08:50 AM






Hi,

I've a VSA implementation and I'm able to invoke any method in
my script.

Now I want to hook up event handler in the code from an external
event source.

Normally I use this:

EventInfo eInfo = this.MyForm.GetType().GetEvent("EventName");
Delegate d = Delegate.CreateDelegate(eInfo, this, "Button_Click");
eInfo.AddEventHandler(this, d);

"this" points to the class where "Button_Click" is available.
This works very well.

No I want the event handler, defined in my VSA script.

EventInfo eInfo = this.MyForm.GetType().GetEvent("EventName");
Delegate d = Delegate.CreateDelegate(eInfo, MyVSA, "Button_Click");
eInfo.AddEventHandler(MyVSA, d);

Question: How to get MyVSA?

object MyVSA = vsaEngine.Assembly.INeedAMethodLike_GetRunningInst ance();

Any ideas? Or is there any other way to hook up script methods
as event handlers for the host application?

Thank you,

Joerg

Reply With Quote
  #2  
Old   
bruce barker
 
Posts: n/a

Default Re: Direct Access to VSA project Assembly - 07-01-2004 , 02:05 PM






you have only loaded code in the vsa engine. there are no class instances
until you code creates one. if you used vb script, and a module, you have
created static methods for which there is no instance. you can create a
class in script instead and create an instance of this class.

if you want to stick with static metods the common approach is you create
your own delegate for the event, and it uses reflection to find a method to
call in vsa.

-- bruce (sqlwork.com)



"Joerg Krause" <joerg (AT) krause (DOT) net> wrote

Quote:
Hi,

I've a VSA implementation and I'm able to invoke any method in
my script.

Now I want to hook up event handler in the code from an external
event source.

Normally I use this:

EventInfo eInfo = this.MyForm.GetType().GetEvent("EventName");
Delegate d = Delegate.CreateDelegate(eInfo, this, "Button_Click");
eInfo.AddEventHandler(this, d);

"this" points to the class where "Button_Click" is available.
This works very well.

No I want the event handler, defined in my VSA script.

EventInfo eInfo = this.MyForm.GetType().GetEvent("EventName");
Delegate d = Delegate.CreateDelegate(eInfo, MyVSA, "Button_Click");
eInfo.AddEventHandler(MyVSA, d);

Question: How to get MyVSA?

object MyVSA = vsaEngine.Assembly.INeedAMethodLike_GetRunningInst ance();

Any ideas? Or is there any other way to hook up script methods
as event handlers for the host application?

Thank you,

Joerg



Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.