private void BlockIconGrid_SelectionChanged(object sender, SelectionChangedEventArgs e) { var item = (sender as ListView).SelectedItem; if (item != null) { selectedIconPath = (ChallengerIcon)item; } }
private void okayButton_Click(object sender, RoutedEventArgs e) { string newIconName = iconNameLabel.Text; if (iconLoaded == false) { MessageBox.Show("Please select an Icon to upload."); } else if (iconLoaded == true && string.IsNullOrEmpty(categoryDropdown.SelectedItem.ToString())) { MessageBox.Show("Please select a category before upload."); } else if (iconLoaded == true && !string.IsNullOrEmpty(categoryDropdown.SelectedItem.ToString()) && !string.IsNullOrEmpty(iconNameLabel.Text)) { try { category = categoryDropdown.SelectedItem.ToString(); string pathWithCategory = System.IO.Path.Combine(iconFolder, category); targetDirectory = System.IO.Path.Combine(pathWithCategory, newIconName); File.Copy(iconFileName, targetDirectory, false); NewIcon = new ChallengerIcon() { Name = newIconName, Path = targetDirectory, Category = category }; DialogResult = true; this.Close(); } catch (IOException) { MessageBox.Show("Icon Name already exists. Try changing the Icon File name."); } } }