Exemplo n.º 1
0
        private void DeleteButton_Click(object sender, EventArgs e)
        {
            if (FlowTreeView.SelectedNode != null && (FlowTreeView.Nodes.Count > 1 || !FlowTreeView.SelectedNode.Equals(FlowTreeView.Nodes[0])))
            {
                var dialog = (Dialog)FlowTreeView.SelectedNode.Tag;

                FlowTreeView.BeginUpdate();
                if (FlowTreeView.SelectedNode.Parent == null)
                {
                    _script.Start.Dialogs.Remove(dialog);
                    FlowTreeView.Nodes.Remove(FlowTreeView.SelectedNode);
                    FlowTreeView.SelectedNode = FlowTreeView.Nodes[0];
                }
                else
                {
                    var root = FlowTreeView.SelectedNode.Parent;
                    root.Nodes.Remove(FlowTreeView.SelectedNode);
                    FlowTreeView.SelectedNode = root;

                    var parent = (Dialog)root.Tag;
                    parent.Dialogs.Remove(dialog);
                }
                FlowTreeView.EndUpdate();
            }
        }
Exemplo n.º 2
0
        private void ApplyButton_Click(object sender, EventArgs e)
        {
            if (FlowTreeView.SelectedNode != null)
            {
                var dialog = (Dialog)FlowTreeView.SelectedNode.Tag;

                dialog.Id      = IdTextBox.Text.Trim();
                dialog.Label   = LabelTextBox.Text.Trim();
                dialog.Phrases = PhrasesTextBox.Lines;
                dialog.Goto    = GotoCheckBox.Checked ? GotoTextBox.Text.Trim() : string.Empty;

                FlowTreeView.BeginUpdate();
                FlowTreeView.SelectedNode.Text = string.Format("{0} ({1})", dialog.Label, dialog.Id);
                FlowTreeView.EndUpdate();
            }
        }
Exemplo n.º 3
0
        private void AddButton_Click(object sender, EventArgs e)
        {
            if (FlowTreeView.SelectedNode != null)
            {
                var dialog = (Dialog)FlowTreeView.SelectedNode.Tag;
                var child  = new Dialog()
                {
                    Label = "Novo diálogo"
                };
                dialog.Dialogs.Add(child);

                FlowTreeView.BeginUpdate();
                FlowTreeView.SelectedNode.Nodes.Clear();
                foreach (var node in dialog.Dialogs)
                {
                    AddTree(node, FlowTreeView.SelectedNode);
                }
                FlowTreeView.SelectedNode.ExpandAll();
                FlowTreeView.SelectedNode = FlowTreeView.SelectedNode.Nodes[FlowTreeView.SelectedNode.Nodes.Count - 1];
                FlowTreeView.EndUpdate();
            }
        }
Exemplo n.º 4
0
        private void ReloadTree()
        {
            PagesTabControl.SelectedIndex = 0;

            ChoosePhraseTextBox.Text   = _script.ChoosePhrase;
            ContinuePhraseTextBox.Text = _script.ContinuePhrase;
            RestartPhraseTextBox.Text  = _script.RestartPhrase;

            GreetingsTextBox.Lines = _script.Greetings;
            UnknowTextBox.Lines    = _script.Unknow;

            FlowTreeView.BeginUpdate();
            FlowTreeView.Nodes.Clear();

            AddTree(_script.Start);
            if (FlowTreeView.Nodes.Count > 0)
            {
                FlowTreeView.SelectedNode = FlowTreeView.Nodes[0];
            }

            FlowTreeView.ExpandAll();
            FlowTreeView.EndUpdate();
        }