Ejemplo n.º 1
0
        private async void btnApply_Click(object sender, EventArgs e)
        {
            if (treeViewNeuralActions.SelectedNode != null)
            {
                var node = (NeuralActionModel)treeViewNeuralActions.SelectedNode.Tag;
                node.Name          = tbName.Text;
                node.Description   = tbDescription.Text;
                node.QuestionTitle = tbQuestionTitle.Text;
                node.Title         = tbTitle.Text;
                node.Type          = (ActionType)cbActionType.SelectedValue;

                if (node.Resources == null)
                {
                    node.Resources = new List <string>();
                }
                else
                {
                    node.Resources.Clear();
                }

                foreach (DataGridViewRow row in dataGridViewResources.Rows)
                {
                    var resId = row.Cells[0].Value as string;
                    if (!string.IsNullOrWhiteSpace(resId) && !node.Resources.Contains(resId))
                    {
                        node.Resources.Add(resId);
                    }
                }

                await DbActionCollection.ReplaceOneById(node._id, node);

                await LoadData(treeViewNeuralActions.SelectedNode.Name);
            }
        }
Ejemplo n.º 2
0
        private async void lnkLabels_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            if (treeViewNeuralActions.SelectedNode != null)
            {
                var node   = (NeuralActionModel)treeViewNeuralActions.SelectedNode.Tag;
                var editor = new ListEditor("Neural action label editor", node.Labels);
                var res    = editor.ShowDialog();
                if (res == DialogResult.OK)
                {
                    node.Labels = editor.Result;
                    await DbActionCollection.ReplaceOneById(node._id, node);

                    treeViewNeuralActions.SelectedNode.Tag = node;
                    ReFillData();
                }
            }
        }