public PhotoViewModel() { _currentPhoto = null; _imageDirectory = null; _imageNumber = 0; _imageCount = 0; _imageFiles = new List<string>(); _photos = new PhotoCollection(); _photoDisplayMode = Stretch.Uniform; registerCommands(); //Task.Run(() => // { if (Environment.GetCommandLineArgs().Length > 1) loadImages(Environment.GetCommandLineArgs()[1]); else //LoadImages("C:\\Users\\Ryan\\Pictures\\sky, space and landscapes\\3r4en.jpg"); loadImages("C:\\Users\\Public\\Pictures\\Sample Pictures\\Desert.jpg"); //}); }
private void loadImages(string filename) { CurrentPhoto = new Photo(filename); //thePhoto.Source = currPhoto.Image; // new Bitmap(filename, false); int end = filename.LastIndexOf('\\'); _imageDirectory = filename.Substring(0, end + 1); int count = 0; _imageFiles = new List<string>(); foreach (string file in Directory.GetFiles(_imageDirectory)) { if (isValidImage(file)) { _imageFiles.Add(file); count++; } if (file.Equals(filename)) _imageNumber = count - 1; } _imageCount = count; // images.Sort(); //MessageBox.Show(photos.Count + ""); _photos.Path = _imageDirectory; //MessageBox.Show(_photos.Count + ""); }