private void Add_Files_Button_Click(object sender, RoutedEventArgs e) { var dialog = new Microsoft.Win32.OpenFileDialog { Multiselect = true }; int missing = 0; if (dialog.ShowDialog() != true) { return; } string[] filenames = dialog.FileNames; foreach (string path in filenames) { if (!File.Exists(path)) { continue; } if (Files.Any(f => f.Path == path)) { missing++; } else { Add_File(path, filenames.Length > 1); } } if (missing > 0) { MessageBox.Show($"{missing} файлов не было добавлено, поскольку уже существуют"); } Name_Textbox.Clear(); }
private void Files_Combobox_SelectionChanged(object sender, SelectionChangedEventArgs e) { int index = Files_Combobox.SelectedIndex; if (index < 0) { Icon_Image.Source = null; Name_Textbox.Clear(); Path_Textbox.Clear(); Groups_Combobox.SelectedIndex = -1; } else { Icon_Image.Source = Files[index].ImageSource; Name_Textbox.Text = Files[index].Name; Path_Textbox.Text = Files[index].Path; Groups_Combobox.SelectedIndex = Groups_Combobox.Items.IndexOf(Files[index].Group); } }
private void button5_Click(object sender, EventArgs e) { /*Edit_Card_Form newEditForm = new Edit_Card_Form(); * newEditForm.Show(); * this.Dispose(false);*/ button2.Enabled = false; Name_Textbox.Clear(); Card_Type_TextBox.Clear(); Card_Additional_TextBox.Clear(); Card_Mana_Cost_TextBox.Clear(); Card_Expansion_TextBox.Clear(); Card_Description_TextBox.Clear(); Card_Flavor_Text_TextBox.Clear(); Card_Power_TextBox.Clear(); Card_Toughness_TextBox.Clear(); textBox2.Clear(); textBox1.Clear(); Name_Textbox.ReadOnly = false; }