Thursday, 15 July 2010

Windows Store app live tiles with images from pictures library -



Windows Store app live tiles with images from pictures library -

i have application saves images pictures library. works fine added permissions utilize pictures library in app manifest.

i trying create live tile show these images saved image library can't seem working.

i saw possible create uri app local folder or app installed folder, didn't find illustration of using absolute path or relative path pictures library.

any help appreciated

thanks

xmldocument widetilexml = tileupdatemanager.gettemplatecontent(tiletemplatetype.tilewide310x150image); xmlnodelist widetileimageattributes = widetilexml.getelementsbytagname("image"); ((xmlelement)widetileimageattributes[0]).setattribute("src", fileabspath); ((xmlelement)widetileimageattributes[0]).setattribute("alt", ""); // create new tile notification. updater.update(new tilenotification(widetilexml));

as described on http://msdn.microsoft.com/en-us/library/windows/apps/hh465439.aspx, tile image references can utilize ms-appx:///, ms-appdata:///, or http[s]:// uris. is.

as suggest, then, need re-create image pictures library local app data. utilize storagefile.copyasync method this. aware, however, tile images limited 200kb, , it's of images in pictures library far larger that. means you'll need alter size in process. scenario 2 of simple imaging sample has code this.

alternately, can first phone call storagefile.getscaledimageasthumbnailasync image in pictures, requesting thumbnail size appropriate tile template you're using. thumbnail returned storageitemthumbnail random access stream, you'll need re-create bytes file in local app data. should able utilize simple imaging sample code again, picking have input stream , going there.

another piece of code i'll mention written in javascript, might useful: it's scenario 11 of javascript app tiles , badges sample, image editor tiles. might able utilize of code here, though you'd have translate c#.

windows-runtime windows-store-apps winrt-xaml live-tile

No comments:

Post a Comment