public static bool CheckName(PackageBase package, ProjectItemType type, string name) { if (package == null) return true; foreach (var i in package.Items) { if (i.ItemType == type && i.Name == name) return false; } return true; }
void CloseItems(PackageBase package) { foreach (IProjectItem item in package.Items) { if (item is PackageBase) CloseItems((PackageBase)item); if (item is IDocumentItem) ((IDocumentItem)item).Close(); } }
public static string GetName(PackageBase package, ProjectItemType type, string initName) { string n = initName; int i = 1; do { if (CheckName(package, type, n)) return n; n = initName + i++; } while (true); }
public void Move(IProjectItem item, PackageBase to) { if (!to.items.Contains(item)) { if (!Project.CheckName(to, item.ItemType, item.Name)) throw new BadSyntaxException(Strings.ErrorNameExists.FormatArgs(item.Name)); items.Remove(item); to.items.Add(item); item.Package = to; OnModified(EventArgs.Empty); } }