CCT.NUI.WPFSamples.ImageLoader.LoadImages C# (CSharp) Méthode

LoadImages() public méthode

public LoadImages ( ) : IList
Résultat IList
        public IList<Image> LoadImages() 
        {
            var result = new List<Image>();
            foreach (var imagePath in Directory.GetFiles(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Images"), "*.jpg"))
            {
                var source = new BitmapImage();
                source.BeginInit();
                source.UriSource = new Uri(imagePath);
                source.CacheOption = BitmapCacheOption.OnLoad;
                source.EndInit();
                var image = new Image { Source = source };
                image.Width = 600;
                image.Height = source.Height * image.Width / source.Width;
                result.Add(image);
            }
            return result;
        }
    }