private void ShellTreeView_AfterLabelEdit(object sender, NodeLabelEditEventArgs e) {
if (e.Label != null) {
if (e.Label.Length > 0) {
if (e.Label.IndexOfAny(new char[] { '@', '.', ',', '!' }) == -1) {
// Stop editing without canceling the label change.
e.Node.EndEdit(false);
var fo = new IIFileOperation(this.Handle);
fo.RenameItem((e.Node.Tag as IListItemEx)?.ComInterface, e.Label);
fo.PerformOperations();
} else {
/* Cancel the label edit action, inform the user, and
place the node in edit mode again. */
e.CancelEdit = true;
MessageBox.Show("Invalid tree node label.\n The invalid characters are: '@','.', ',', '!'", "Node Label Edit");
e.Node.BeginEdit();
}
} else {
/* Cancel the label edit action, inform the user, and place the node in edit mode again. */
e.CancelEdit = true;
MessageBox.Show("Invalid tree node label.\nThe label cannot be blank", "Node Label Edit");
e.Node.BeginEdit();
}
}
}