Let some baselines be given ...
- Exe launches
- EXE loads DLLs containing plugins
- EXE creates an instance of the type (plugin)
- The plugin begins to wait for the event.
- Exe is waiting
- An external event (in another thread) is marked by the plugin instance
- EXE event notification
If so, the easiest way is to define an event in your plugin.
public interface IPlugin { public event EventHandler SomethingHappened; public void StartWatchingForSomething(); } where the code would be something like... public static void Main() { foreach (var plugin in LoadAllPluginTypes())
Note that event handlers will run in the same thread as the notification. For example, if your plugin responds to file system events (via FileSystemWatcher), event handlers will run in the same thread as the thread executing the code "defined in the DLL".
If your EXE is a winforms or WPF project, you will need to run Invoke or Dispatcher.Invoke to get the UI thread before updating any visual controls.
source share