Forgive me if this isn't the correct place to post - but it is project related.
My SL experience is still relatively young and i'm trying to prototype a framework for a new application in double quick time.
I'm following basic practices for localizing the UI at http://msdn.microsoft.com/en-us/library/cc838238(VS.95).aspx.
>
I found that my silverlightFX window was always falling back to the neutral resource. I traced it to the fact that the silverlightFX applicationContext starting event fires before the application startUp event. From what i could tell i had two choices, modify the silverlightFX code or derive from the applicationContext class. The latter was cleaner. Here it is:
public class ApplicationStartupEventArgs : EventArgs
{
public IDictionary<string, string> StartupArgs { get; set; }
}
public class ResourceAwareApplicationContext : ApplicationContext
{
protected EventHandler<ApplicationStartupEventArgs> _startupHandler;
/// <summary>
/// The event raised when the application is starting. This event occurs before the silverlightFX applicationContext
/// initialises the theme or the main window.
/// </summary>
public event EventHandler<ApplicationStartupEventArgs> Starting
{
add
{
_startupHandler = (EventHandler<ApplicationStartupEventArgs>)Delegate.Combine(_startupHandler, value);
}
remove
{
_startupHandler = (EventHandler<ApplicationStartupEventArgs>)Delegate.Remove(_startupHandler, value);
}
}
protected override void OnStarting()
{
if (this._startupHandler != null)
this._startupHandler(this, new ApplicationStartupEventArgs() { StartupArgs = this.StartupArguments });
base.OnStarting();
}
}
This works well for now. My question is is this the correct approach? Did i miss something simple that the silverlightFX framework provides?
Thanks.