// Allow the user to pic several pictures public void UploadCommandMethod() { this.Message = "Calculating..."; var dialog = new OpenFileDialog { InitialDirectory = System.AppDomain.CurrentDomain.BaseDirectory }; dialog.DefaultExt = ".png"; dialog.Filter = "Images (*.jpeg;*.png;*.jpg)|*.jpeg;*.png;*.jpg|JPEG Files (*.jpeg)|*.jpeg|PNG Files (*.png)|*.png|JPG Files (*.jpg)|*.jpg"; dialog.Multiselect = true; dialog.Title = "Select your images"; DialogResult dr = dialog.ShowDialog(); if (dr == System.Windows.Forms.DialogResult.OK) { int i = 0; foreach (String file in dialog.FileNames) { M8Image m8Image = new M8Image(file, i); this.ImageList.Add(m8Image); i++; } CalculateSharpness(); } }
// Tell to the user which is the sharpest picture and where it is plced in the list public void CalculateSharpness() { foreach (M8Image img in this.ImageList) { img.SetSharpness(); } M8Image result = ImageList.OrderByDescending(x => x.Sharpness).FirstOrDefault(); this.Message = "The sharpest image is " + result.Name + " placed " + result.Place.ToString() + " in the list"; }