private void btnOk_Click(object sender, EventArgs e) { //Check name string name = txtName.Text; foreach (ResourceNode c in _parentNode.Children) { if (c.Name == name && !(c is RSARFolderNode)) { MessageBox.Show(this, "A resource with that name already exists!", "What the..."); return; } } _newNode = new RSARSoundNode { Name = name }; _parentNode.AddChild(_newNode); if (treeResource.SelectedNode != null) { RSARSoundNode existing = ((BaseWrapper)treeResource.SelectedNode).Resource as RSARSoundNode; if (existing != null) { _newNode._sound3dParam = existing._sound3dParam; _newNode._waveInfo = existing._waveInfo; _newNode._seqInfo = existing._seqInfo; _newNode._strmInfo = existing._strmInfo; _newNode._fileId = existing._fileId; _newNode._playerId = existing._playerId; _newNode._volume = existing._volume; _newNode._playerPriority = existing._playerPriority; _newNode._soundType = existing._soundType; _newNode._remoteFilter = existing._remoteFilter; _newNode._panMode = existing._panMode; _newNode._panCurve = existing._panCurve; _newNode._actorPlayerId = existing._actorPlayerId; } } DialogResult = DialogResult.OK; Close(); }
private void btnOk_Click(object sender, EventArgs e) { //Check name string name = txtName.Text; foreach (ResourceNode c in _parentNode.Children) { if ((c.Name == name) && !(c is RSARFolderNode)) { MessageBox.Show(this, "A resource with that name already exists!", "What the..."); return; } } _newNode = new RSARSoundNode(); _newNode.Name = name; _parentNode.AddChild(_newNode); this.DialogResult = DialogResult.OK; Close(); }