c# - How to create SampleDataSource for GridApp template using images that stored at PicturesLibrary? -
i trying create datasource gridapp. images pictureslibrary using getfilesasync(). modified sampledatasource.cs: in data structure use storagefile imagepath instead of string imagepath. , of course wrote code creates bitmapimage storagefile using irandomaccessstream instead of creation bitmapimage uri.
so code can compiled doesn't work. here reasons of it: async method getfilesasync() not blocks main thread. , groupeditemspage.xaml.cs asks sampledatasource before getfilesasync() provides necessary information. cause exception typeinitializationexception.
the obvious solution use sync analog of getfilesasync(). there new problems:
- it seems it's impossible files knownfolders.pictureslibrary synchronously.
- it's whole bad idea, because if have big amount of pictures generation of groupeditemspage cause freezing.
so, how can solve problem? asking conception of solution. how should organize architecture of app?
Comments
Post a Comment