1

私が構築しているマスター Silverlight コンテナー アプリケーションに XAP ファイルをロードするために、MEF/Prism アプローチを使用しないことにしました。

1 つのマスター Silverlight アプリケーションと、ロードされる予定の 2 つのアプリケーションがあります。ロード コードは正常に動作しています。唯一の問題は、XAP アプリケーションをロードするときに、App.xaml アプリケーション コンテキストをロードしたいことです。これは、私が構築した IApplication インターフェイスを再生しているところです。

 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>

私が直面している問題は、AAApp をマスター Silverlight アプリケーションに動的にロードするときに、(App)Application.Current が AAApp コンテキストでロードしている XAP に変更されていることです。

誰かがこの問題を抱えていて、これについて知っていますか。

(App)Application.Current を使用して、アプリケーションなどのグローバル変数を保存していますが、この変更により、すべてが壊れています。

ありがとう

4

0 に答える 0