简体   繁体   中英

vb.net c# static event?

I have a plugin that creates an object that has an event. Is there a way for a seperate class to monitor this event, even though it does not have control of the object?

For example, I have a plugin that calls an object that uploads some data. When the data is uploaded, the event is triggered to say that this is so. In my client app, I want this to be notified when this event triggers so that it can do something.

The plugin and client will be in C#, and the event class is written in VB.net.

Would it simply be a case of the object notifying the plugin, and in turn, the plugin notifying the client app?

Is this possible?

Thanks.

EDIT (in response to request for code):

The code is fairly simple, it will be a case of in the DLL:

Object O = new Object();
O.CompleteEvent += (BLAH BLAH);
O.Run();

Now when run completes, it will trigger the CompleteEvent.

I want it to be noticed that this event has triggered within a completely different assembly that does not have the O object. The new assembly can monitor the event, however it will be outside the scope of the O object. I hope i'm explaining this okay?

As mentioned earlier, would it simply be a case of the dll then notifying the client assembly that the run is complete?

Events can be static or instance, just like any other class members. And you can subscribe static and instance methods to either type.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM