Example #1
0
 private void NodeNameKeyPress(object sender, KeyPressEventArgs e)
 {
     if (e.KeyChar == (char)Keys.Return)
     {
         if (ValidateNodeName())
         {
             txtName.BackColor = System.Drawing.Color.White;
             _name             = txtName.Text.Trim();
             NodeNameChangedEventArgs nodeNameChangedEventArgs = new NodeNameChangedEventArgs
             {
                 NodeName    = txtName.Text.Trim(),
                 OldNodeName = _originalName
             };
             OnNodeNameChanged(nodeNameChangedEventArgs);
             _originalName = _name;
             e.Handled     = true;
         }
         else
         {
             txtName.BackColor = System.Drawing.Color.MistyRose;
             txtName.Text      = _originalName;
             txtName.SelectAll();
         }
     }
 }
Example #2
0
 protected virtual void OnNodeNameChanged(NodeNameChangedEventArgs e)
 {
     if (!_externallySet)
     {
         NodeNameChanged?.Invoke(this, e);
     }
 }