I have decided not to use the MEF/Prism approach to loading XAP files into a master Silverlight container application i am building.
I have 1 Master Silverlight application, and 2 x Applications that are going to be loaded in. My loading code is working fine, the only problem is that when i load the XAP applications in i want to load the App.xaml Application context in, as this is where i am playing an IApplication interface i have built.
public partial class AAApp : IApplication
{
#region IApplication Members
private object userContext;
private List<Silverlight.Common.Classes.ApplicationMenuItem> menuItemsList;
private Silverlight.Common.Controls.ApplicationMaster applicationMaster;
public object UserContext
{
get
{
return userContext;
}
set{
userContext = value;
}
}
public List<Silverlight.Common.Classes.ApplicationMenuItem> MenuItemsList
{
get
{
return menuItemsList;
}
set
{
menuItemsList = value;
}
}
public string ApplicationName
{
get { return "Application Manager"; }
}
public string ApplicationVersion
{
get { return "Version 0.1"; }
}
public Guid GUID
{
get { return new Guid("{ACD4793E-47D8-4DB7-9A32-FDB9DD6CAFD2}"); }
}
public bool IsFullScreen
{
get { return false; }
}
public Silverlight.Common.Controls.ApplicationMaster MasterControl
{
get
{
return applicationMaster;
}
set
{
applicationMaster = value;
}
}
public bool IntialiseApp()
{
applicationMaster = new Silverlight.Common.Controls.ApplicationMaster();
applicationMaster.SetApplicationContent(new MainPage());
return true;
}
public bool CloseApp()
{
return true;
}
#endregion
}
<Application xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="Test.Application.ApplicationManager.AAApp"
>
<Application.Resources>
</Application.Resources>
</Application>
The Problem i am facing is when i dynamically load AAApp in to my master silverlight Application, my (App)Application.Current is being changed to the XAP i am loadings in AAApp context.
Has anyone had this problem, and know away around this.
I use the (App)Application.Current alot to store global variables for my applications etc, and with this changing it is breaking everything.
Thanks