I've got a MenuManager class to which each module can add a key and and element to be loaded into the main content:
private Dictionary<string,object> _mainContentItems = new Dictionary<string,object>();
public Dictionary<string,object> MainContentItems
{
get { return _mainContentItems; }
set { _mainContentItems = value; }
}
So the customer module registers its views like this:
layoutManager.MainContentViews.Add("customer-help", this.container.Resolve<HelpView>());
layoutManager.MainContentViews.Add("customer-main", this.container.Resolve<MainView>());
So then later to bring a specific view to the front I say:
layoutManager.ShowMainContentView("customer-help");
And to get the default view (first view registered), I say:
layoutManager.ShowDefaultView("customer");
And this works fine.
However, I want to eliminate the "code smell" with the hyphen which separates module name and view name, so I would like to register with this command:
layoutManager.MainContentViews.Add("customer","help", this.container.Resolve<HelpView>());
But what is the best way to replace my current Dictionary, e.g. what comes to mind are these:
Dictionary<string, string, object> (doesn't exist)
Dictionary<KeyValuePair<string,string>, object>
Dictionary<CUSTOM_STRUCT, object>
The new collection needs to be able to do this:
- get a view with module and view key (e.g. "customer", "help" returns 1 view)
- get a collection of all views by module key (e.g. "customer" returns 5 views)