public override void LoadedFromData(ILazyLoadingItem loadedData) { if (IsCached) { return; } IsCached = true; if (!string.IsNullOrEmpty(this.ThumbnailKey)) { using (var proxy = new MogamiApiServiceClient()) { proxy.Login(); var loadthumbparam = new REQUEST_LOADTHUMBNAIL { ThumbnailKey = ThumbnailKey }; var rsp = proxy.LoadThumbnail(loadthumbparam); using (Stream stream = new MemoryStream(rsp.ThumbnailBytes)) { // ロックしないように指定したstreamを使用する。 BitmapDecoder decoder = BitmapDecoder.Create( stream, BitmapCreateOptions.None, // この辺のオプションは適宜 BitmapCacheOption.Default // これも ); BitmapSource bmp = new WriteableBitmap(decoder.Frames[0]); bmp.Freeze(); this.Thumbnail = bmp; } } } }
public override void LoadedFromData(ILazyLoadingItem loadedData) { if (IsCached) { return; // 読み込み済みの場合は、再度読み込みは行わない。 } IsCached = true; try { string filePath = string.Format(@"X:\30_Artifact\10_AdsImage\99_Event\C87\(C87) [Melty Pot (Mel)] Happy Style! 2 (ゆゆ式)\{0}", this.Label); //string filePath = this.FilePath; using (Stream stream = new FileStream( filePath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite | FileShare.Delete )) { // ロックしないように指定したstreamを使用する。 BitmapDecoder decoder = BitmapDecoder.Create( stream, BitmapCreateOptions.None, // この辺のオプションは適宜 BitmapCacheOption.Default // これも ); BitmapSource bmp = new WriteableBitmap(decoder.Frames[0]); bmp.Freeze(); this.Thumbnail = bmp; } } catch (Exception exc) { LOG.WarnFormat("[" + exc.Message + "]\n" + exc.StackTrace); } }
public override void LoadedFromData(ILazyLoadingItem loadedData) { // EMPTY }
/// <summary> /// 遅延ロード処理 /// </summary> /// <param name="loadedData"></param> public abstract void LoadedFromData(ILazyLoadingItem loadedData);