private void onBtn_DeleteNPC(object sender, RoutedEventArgs e) { if (dgNPCs.ItemsSource == null) { return; } var list = (ObservableCollection <LevelNPCType>)dgNPCs.ItemsSource; LevelNPCType npcToDelete = (LevelNPCType)dgNPCs.SelectedItem; list.Remove(npcToDelete); ModelManager.Instance.LevelNpcXlsData.DataList.Remove(npcToDelete); }
private void onBtn_ChangeNPCOrigin(object sender, RoutedEventArgs e) { if (dgNPCs.SelectedItem == null) { return; } WarriorPickWindow window = new WarriorPickWindow(); if (window.ShowDialog() == true) { LevelNPCType npcType = dgNPCs.SelectedItem as LevelNPCType; npcType.Type = window.PickedWarriorID; } }