private void AddClick(object sender, RoutedEventArgs e) { OpenFileDialog dialog = new OpenFileDialog(); dialog.Filter = "Image Files | *" + String.Join(";*", Extension); dialog.Multiselect = true; dialog.CheckFileExists = true; dialog.Title = "Choose Image"; if (dialog.ShowDialog() == true) { string [] fileNames = dialog.FileNames; ProjectTools.AddFiles(fileNames); /* Add files to _data so that the ListBox is updated. Note that as Images are added to the project directory, * images will be added in the _data with ImageData having header Path.DirectorySeparatorChar. */ List <string> temp = new List <string>(); foreach (var file in fileNames) { temp.Add(Path.GetFileName(file)); } if (fileNames.Length != 0) { txURL.Text = fileNames.Last(); } _data.OrderBy(image => image.Header).ElementAt(0).Images.AddRange(fileNames); } }
private void AddClick(object sender, RoutedEventArgs e) { OpenFileDialog dialog = new OpenFileDialog(); dialog.Filter = "Image Files|*" + String.Join(";*", Extension) + "|All Files|*.*"; dialog.Multiselect = true; dialog.CheckFileExists = true; dialog.Title = "Choose Image"; if (dialog.ShowDialog() == true) { string[] fileNames = dialog.FileNames; var files = ProjectTools.AddFiles(fileNames, ItemType.Resource); imgDisplay.SelectedItem = files.FirstOrDefault(); } }