private void AddBattleRole(object newEntry) { try { if (newEntry != null) { ModelClasses.BattleRole newRole = (ModelClasses.BattleRole)newEntry; if (newBattleroles.Contains(newRole)) { existingBattleroles.Add(newRole); lbExistingTemplates.Items.Add(newRole); isEdited = true; } else { int idx = existingBattleroles.FindIndex(x => x.Name == newRole.Name); if (idx > -1) { existingBattleroles[idx].ImageFileName = newRole.ImageFileName; existingBattleroles[idx].Icon = newRole.Icon; isEdited = true; } } } } catch { } }
private void GetNewBattleRoles() { if (importedBattleroles != null && existingBattleroles != null) { newBattleroles.Clear(); foreach (ModelClasses.BattleRole role in importedBattleroles) { if (!existingBattleroles.Where(x => x.ToString() == role.ToString()).Any()) { newBattleroles.Add(role); } } } }