예제 #1
0
        private void Textbox_TextChanged(object sender, TextChangedEventArgs e)
        {
            var stextBox = sender as RichTextBox;
            var textBox  = new TextRange(stextBox.Document.ContentStart, stextBox.Document.ContentEnd);

            if (textBox != null)
            {
                if (textBox.Text != "")
                {
                    expression = new Expression(textBox.Text);

                    var paras = GetParametersInExpression(textBox.Text).Distinct().ToList();

                    if (paras.Any())
                    {
                        RemoveAllInputPortsFromNode(paras);

                        var filteredParas = paras.Where(parameter => InputPorts.All(p => p.Name != parameter)).ToList();

                        foreach (var parameter in filteredParas)
                        {
                            AddInputPortToNode(parameter, typeof(object));
                        }
                    }
                }
                else
                {
                    expression = null;
                    RemoveAllInputPortsFromNode();
                }
            }

            Calculate();
        }