Reputation: 6194
I am building a Silverlight application that takes a single InitParam that will be used throughout an application (at least in a number of services). We are looking at building the app using Prism and what I would like to know is - how do we instantiate a service that takes this parameter and makes it globally available?
Upvotes: 1
Views: 272
Reputation: 69262
Are you asking how to read the InitParams or what you should do with it once you've read it? To read it, you access it in the StartupEventArgs in the Application.Startup event.
private void Application_Startup(object sender, StartupEventArgs e) {
string blah;
if (e.InitParams.TryGetValue("ID", out blah)) {
...
}
}
Once you get it out, I suppose you could add it to your container as a named string. Or you could just stick the StartupEventArgs in the container and access it as needed.
Upvotes: 1