Hi,
I'm writing a program that allows developers to write AddIn's for it and I'd like developers to be able to hook into events happening in the program.
My code isn't compiling because I can't declare a delegate in the IMyProgram interface.
So I suppose this is more of a design question. How would you go about getting an interface passed to the AddIn so the AddIn can hook into program events?
[AddInContract]
public interface IMyProgramAddInContract : IContract {
/// <summary>
/// Initializes AddIn
/// </summary>
void Init(IMyProgram instance);
System.Drawing.Image AddInIcon { get; }
String DisplayName { get; }
String Description { get; }
}
[AddInContract]
public interface IMyProgram : IContract {
public delegate EventHandler EmailEventHandler(object sender, EmailEventArgs args);
public event EmailEventHandler BeforeCheck;
public event EmailEventHandler AfterCheck;
public event EmailEventHandler EmailDownloaded;
public event EmailEventHandler OnProcessMessage;
}
[AddInBase]
public class EmailEventArgs : EventArgs {
public override string ToString() {
return "todo";
}
}