internal string GetValidName(Action reqAction, string name) { int max = 0; bool found = false; foreach (Action ac in Actions) { if (ac == reqAction) { continue; } string bname; int index; WidgetUtils.ParseWidgetName(ac.Name, out bname, out index); if (name == ac.Name) { found = true; } if (name == bname && index > max) { max = index; } } if (found) { return(name + (max + 1)); } else { return(name); } }