private void btnItemsClone_Click(object sender, RoutedEventArgs e) { NpcData sel_item = (NpcData)lstItems.SelectedItem; if (sel_item == null) { return; } // string name = StringUtils.getString(sel_item.Name); if (name == null) { name = ""; } int id = getNewID(); // NpcData item = new NpcData(); sel_item.Clone(item); item.ID = id.ToString(); item.Name = getCloneName(name); item.UpdateDisplayValues(); // npcMgr.Items.Add(item); npcMgr.HasChanges = true; lstItems.SelectedItem = item; lstItems.ScrollIntoView(item); }
private void btnItemsAdd_Click(object sender, RoutedEventArgs e) { int id = getNewID(); NpcData item = new NpcData(); item.ID = id.ToString(); item.Name = "[new_npc_" + id + "]"; item.UpdateDisplayValues(); // npcMgr.Items.Add(item); npcMgr.HasChanges = true; lstItems.SelectedItem = item; lstItems.ScrollIntoView(item); }