Silverlight XAPファイルの分割 のバックアップ(No.1) - PukiWiki

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


トップ   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS

yVoC[UNLIMITȂ1~] ECirŃ|C Yahoo yV LINEf[^[Ōz500~`I


z[y[W ̃NWbgJ[h COiq 萔O~ył񂫁z COsیI COze