I'm currently building a set of application in WPF, they will use Prism as framework.
They will have a lot in common, and the only thing that will changes between 2 of my app is what will be loaded in the Prism region.
So I wanted to put some things in common.
One thing that I didn't succeed is to make one common "Application" implementation with all the common part:
The goal was to have:
Application <-- BaseApp(abstract) <-- MySpecificAppplication(code behind only)
The goal is to have every resources declarations in BaseApplication, the OnStartup
implementation in common, and only the specific part(in my case, which Bootstrapper I want to run) in the end class.
Here are some code:
public abstract partial class BaseApp : Application //This class has also some XAML for resources loading, but pretty basic.
{
protected override void OnStartup(StartupEventArgs e)
{
base.OnStartup(e);
BaseBootstrapper clientBootstrapper = GetBootstrapper();
//Some initialization stuff
clientBootstrapper.Run();//This will cause Prism to load the correct first View(shell)
}
protected abstract BaseBootstrapper GetBootstrapper();
}
And the specific implementation
public class MySpecificApp : BaseApp
{
protected override BaseBootstrapper GetBootstrapper(){
return //something ;
}
}
But I build, I get an error:
Program does not contain a static 'Main' method suitable for an entry point
Is this supported?