private static async Task PicturesLoad(List <PageFile> lPic, ListView imageFiles) { //Pictures lPics = lPic[26].Items[1].Items[0].Value; // load file from document library. Note: select document library in capabilities and declare .png file type foreach (PageFile pFile in lPic) { PagePicture prFile = await LoadFile(pFile, 0, 0); imageFiles.Items.Add(prFile); } }
private static async Task <PagePicture> LoadFile(PageFile aPic, double dScrnHeight, double dScrnWidth) { PagePicture lPic = new PagePicture(aPic, dScrnHeight, dScrnWidth); string sFileName = lPic.FullName; if (lPic.BMImage == null) { StorageFile sampleFile = await StorageFile.GetFileFromPathAsync(sFileName); lPic.BMImage = await LoadImage(sampleFile); } return(lPic); }
public static async Task PictureImageLoad(PageFile asPic, ItemsControl agvImages) { double dScrnHeight = 0, dScrnWidth = 0; FrameworkElement dSizeFind = agvImages.Parent as FrameworkElement; while (dSizeFind as Page == null && dSizeFind.Parent != null) { dSizeFind = dSizeFind.Parent as FrameworkElement; } if (dSizeFind as Page != null) { dScrnHeight = dSizeFind.ActualHeight; dScrnWidth = dSizeFind.ActualWidth; if (DisplayInformation.GetForCurrentView().CurrentOrientation == DisplayOrientations.Landscape || DisplayInformation.GetForCurrentView().CurrentOrientation == DisplayOrientations.LandscapeFlipped) { if (dScrnHeight > dScrnWidth) { double dSwap = dScrnWidth; dScrnWidth = dScrnHeight; dScrnHeight = dSwap; } } else if (dScrnHeight < dScrnWidth) { double dSwap = dScrnWidth; dScrnWidth = dScrnHeight; dScrnHeight = dSwap; } } PagePicture lPic = await LoadFile(asPic, dScrnHeight, dScrnWidth); agvImages.Items.Clear(); agvImages.Items.Add(lPic); }