SilverLight?
サイズが大きいSilverlightアプリケーションの場合、複数の.xapか.zipファイルに分割して、WebClientクラスのOpenReadAsyncメソッドによって、ダウンロードしてから、Application.GetResourceStreamメソッドを使用し、リソースのストリーム情報を得られる。
StreamResourceInfo zipStream = new StreamResourceInfo(e.Result as Stream, null);
// 「SubContents.dll」はサブパッケージの名前。
StreamResourceInfo assemblyStream = Application.GetResourceStream(zipStream, new Uri("SubContents.dll", UriKind.Relative));
//ここまで動的にアセンブリをロードするサンプルにも適用する
AssemblyPart assemblyPart = new AssemblyPart();
// 現在のアプリケーションドメインにアセンブリをロードします。
Assembly assembly = new AssemblyPart().Load(assemblyStream.Stream);
//サブXAPのコンテンツを読み込む
Type type = null;
if (assembly != null)
{
type = Type.GetType("SubContents.Views.ExternalAssemblyView" + "," + assembly, false);
}
if (type != null)
{
UIElement element = Activator.CreateInstance(type) as UIElement;
this.ContentGrid.Children.Add(element);
}
コメント:
0
e[NȂECir Yahoo yV LINEf[^[Ōz500~`I
z[y[W ̃NWbgJ[h COiq@COsیI COze