private void Add_Click(object sender, RoutedEventArgs e) { var addwnd = new AddWindow(); ListBoxUnits.BeginInit(); addwnd.ShowDialog(); ListBoxUnits.EndInit(); }
private void Delete_Click(object sender, RoutedEventArgs e) { if (ListBoxUnits.SelectedItem == null) { return; } var unit = (KeyValuePair <string, Unit>)ListBoxUnits.SelectedItem; ListBoxUnits.BeginInit(); Init.Units.Remove(unit.Key); ListBoxUnits.EndInit(); }