How to control when image data is loaded into memory in Windows Store Apps? -


when creating image in windows store app, how control when data read disk?

in wpf, control when image read disk using bitmapcacheoptions. bitmapcacheoptions.ondemand postpone reading data disk until image data needed. there few downsides this:

  • io costs appeared ui delays;
  • if stream used image source, stream not closed;
  • if file used image source, file locked.

to address problem use bitmapcacheoptions.onload read image memory immediately.

how control when image data loaded memory in windows store apps?

wpf code this:

var bitmapimage = new bitmapimage(); bitmapimage.begininit(); bitmapimage.cacheoption = bitmapcacheoption.onload; bitmapimage.urisource = path; bitmapimage.endinit(); bitmapimage.freeze(); 

edit - more info

wpa shows getting 8.8mb image onto screen costs ~330ms. of that, 170ms spent on file io (including 37ms antivirus check file), , 160ms spent on wic decoding.

any ideas how control when file io happens or how trigger wic decoding? right click , open in new tab see full size (right click , open in new tab see full size)

for windows store apps suggest looking accesscache apis - http://msdn.microsoft.com/en-us/library/windows/apps/windows.storage.accesscache.aspx

specifically storageapplicationpermissions class. can add various storage items accessed.

take @ filepickersample (or fileaccesssample) app more information on how can used.


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -