private void MassRename_Click(object sender, RoutedEventArgs e) { bool GroupOnly = (bool)renameGroupOnly.IsChecked; string find = massRenameFind.Text; string replace = massRenameReplace.Text; int counter = 0; if (string.IsNullOrEmpty(find)) { return; } ExtractedGroup CurrentGroup = (ExtractedGroup)tagGroups.SelectedItem; foreach (ExtractedTag t in GroupOnly ? Container.Tags.Where(tt => tt.Group == CurrentGroup.Magic) : Container.Tags) { if (t.Name.Contains(find)) { counter++; t.Name = t.Name.Replace(find, replace); } } MetroMessageBox.Show("Mass Replace", "Successfully renamed " + counter + " tags."); listTags.Items.Refresh(); }
private void tagGroups_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (tagGroups.SelectedIndex > 0) { ExtractedGroup eg = tagGroups.SelectedItem as ExtractedGroup; listTags.ItemsSource = Container.Tags.Where(t => t.Group == eg.Magic).OrderBy(t => t.Name); } else { listTags.ItemsSource = null; } }