Hi,
In order to break functionality in modules, there are two approaches which I am considering -
A) A module can have more than one MainView and based on certain rule I may load specific view. In this case Initialize() method will have if..else construct to decide which of the MainView needs to be created and loaded in the specific region.
Module - Having two views : AddFundView , ActivityView
Module 1 - AddFundView
Thanks
Santosh
In order to break functionality in modules, there are two approaches which I am considering -
A) A module can have more than one MainView and based on certain rule I may load specific view. In this case Initialize() method will have if..else construct to decide which of the MainView needs to be created and loaded in the specific region.
Module - Having two views : AddFundView , ActivityView
public void Initialize()
{
if (ShowFundView)
{
var addFundView = Container.Resolve<AddFundView>();
RegionManager.Regions[Region.Name].Add(addFundView);
}
else if (ShowActivityView)
{
var activityView = Container.Resolve<ActivityView>();
RegionManager.Regions[Region.Name].Add(activityView);
}
}
A)To have one MainView per module. In module initialize resolve this MainView and add it to appropriate region. In this case I would have two modules, Module1 and Module2Module 1 - AddFundView
public void Initialize()
{
var addFundView = Container.Resolve<AddFundView>();
RegionManager.Regions[Region.Name].Add(addFundView);
}
Module 2 - ActivityView public void Initialize()
{
var activityView = Container.Resolve<ActivityView>();
RegionManager.Regions[Region.Name].Add(activityView );
}
Which of the approach should I follow to organize my Module and View ? Is it best practice to have if..else construct in Module initialization to load specific view?Thanks
Santosh