public override void DoImpl() { if (Branch.Parent.GetBranches().Any(b => b.Name == NewName)) { throw new ValidationException(Resources.Validation_DuplicateBranchName, NewName); } if (NewName.IsNullOrEmpty()) { throw new ValidationException(Resources.Validation_InvalidName, NewName); } try { var tn = Tree.Nodes[0].SelectNode(Branch.VPath).AssertNotNull(); tn.ForeColor = NewName.StartsWith("$") ? Color.LightGray : Color.Black; OldName = Branch.Name; Branch.Rename(NewName); } catch (ArgumentException) { throw new ValidationException(Resources.Validation_InvalidName, NewName); } }
public override void DoImpl() { if (Value.Parent.GetValues().Any(v => v.Name == NewName)) { throw new ValidationException(Resources.Validation_DuplicateValueName, NewName); } if (NewName.IsNullOrEmpty()) { throw new ValidationException(Resources.Validation_InvalidName, NewName); } try { var lvi = List.Items.Cast <ListViewItem>().Single(item => item.Text == Value.Name); lvi.ForeColor = NewName.StartsWith("$") ? Color.LightGray : Color.Black; OldName = Value.Name; Value.Rename(NewName); } catch (ArgumentException) { throw new ValidationException(Resources.Validation_InvalidName, NewName); } }