public void AddBooleanEntry() { int count = 1; string newNameBase = "New boolean entry "; string newName = newNameBase + count; while (ContainsResourceName(newName)) { count++; newName = newNameBase + count; } var selectedItem = GetSelectedItems().FirstOrDefault(); ResourceItem item = new ResourceItem(this, newName, false); item.IsNew = true; if (selectedItem != null) { item.SortingCriteria = selectedItem.Name; } else { item.SortingCriteria = item.Name; } ResourceItems.Add(item); SelectItem(item); StartEditing(); }
public ResourceData(string id, params object[] content) { Id = id; foreach (var parobj in content) { if (parobj is ResourceItem) { ResourceItems.Add(parobj as ResourceItem); } else if (parobj is IEnumerable <ResourceItem> ) { foreach (var grpparobj in parobj as IEnumerable <ResourceItem> ) { ResourceItems.Add(grpparobj); } } else { throw new ArgumentException(); } } }