void ButtonClick(object sender, RoutedEventArgs e) { CommandItem item = ((Button)e.Source).DataContext as CommandItem; if (item is null) { return; } LearnWindow w = new LearnWindow(); w.Owner = this; w.InputItem = item; w.ShowDialog(); var items = new Dictionary <string, CommandItem>(); foreach (CommandItem i in CommandItem.Items) { if (items.ContainsKey(i.Input) && i.Input != "") { Msg.Show($"Duplicate found:\n\n{i.Input}: {i.Path}\n\n{items[i.Input].Input}: {items[i.Input].Path}\n\nPlease note that you can chain multiple commands in the same line by using a semicolon as separator.", "Duplicate Found"); } else { items[i.Input] = i; } } }
void ButtonClick(object sender, RoutedEventArgs e) { CommandItem item = ((Button)e.Source).DataContext as CommandItem; if (item is null) { return; } LearnWindow w = new LearnWindow(); w.Owner = this; w.InputItem = item; w.ShowDialog(); var items = new Dictionary <string, CommandItem>(); foreach (CommandItem i in CommandItem.Items) { items[i.Input] = i; } }