private void menuItemAddAction_Click(object sender, EventArgs e)
 {
     TreeNode node = treeView.SelectedNode;
     ClapActionOptions dialog = new ClapActionOptions();
     DialogResult result = dialog.ShowDialog();
     if (result == DialogResult.OK) {
         TreeNode newNode = new TreeNode();
         newNode.Tag = dialog.action;
         newNode.Text = ((ActionSetting)(newNode.Tag)).action;
         newNode.ImageIndex = 1;
         newNode.SelectedImageIndex = 1;
         node.Nodes.Add(newNode);
         node.Expand();
     }
     dialog.Dispose();
 }
 private void editNode(TreeNode node)
 {
     DialogResult result;
     switch (node.Level) {
         case 1:
             ActionGroup group = (ActionGroup)node.Tag;
             ClapNodeOptions dialogPattern = new ClapNodeOptions(group);
             result = dialogPattern.ShowDialog();
             if (result == DialogResult.OK) {
                 group = dialogPattern.actionGroup;
                 node.Text = group.name;
                 node.Tag = group;
             }
             dialogPattern.Dispose();
             break;
         case 2:
             ActionSetting action = (ActionSetting)node.Tag;
             ClapActionOptions actionDialog = new ClapActionOptions(action);
             result = actionDialog.ShowDialog();
             if (result == DialogResult.OK) {
                 action = actionDialog.action;
                 node.Text = action.action;
                 node.Tag = action;
             }
             actionDialog.Dispose();
             break;
         default: break;
     }
 }