I'm implementing a project in MVP pattern and I've got some interfaces like this:
public interface IWizardStep {
event EventHandler NextStep;
}
public interface ISubmitable {
event EventHandler Submit;
}
public interface IStep : ISubmitable, IWizardStep {
string SomeProperty { get; set; }
}
My presenter class then has this:
public class StepPresenter {
public IStep View { get; set; }
public StepPresenter() {
this.View.Submit += new EventHandler(StepSubmitted);
}
void StepSubmitted(object sender, EventArgs e){
//do some processing
//Now I want to raise the Next event
//this.View.NextStep(sender, e) throws a compile error
}
}
So I'm getting a compile error when trying to raise the NextStep event on the within the View. I'm pretty sure that it's a problem because I haven't implemented an event handler for NextStep, but this presenter wont be handling the event.
The presenter will be implemented as 1 step of many in a wizard on a form (ASP.NET, but that doesn't make any difference) and the wizard will catch the NextStep event and show the next step in the wizard.
So how can I have an event on an interface raised like this, or is it impossible?