Ejemplo n.º 1
0
 private void txtTriggerRuleNo_KeyUp(object sender, KeyEventArgs e)
 {
     if (TextBoxHelper.CanEvalNumber((TextBox)sender, e))
     {
         txtTriggerRuleNo_LostFocus(sender, e);
     }
 }
Ejemplo n.º 2
0
        /* L Negating Global Labels */

        public void txtLNegatingLabels_KeyUp(object sender, KeyEventArgs e)
        {
            if (TextBoxHelper.CanEvalString(e))
            {
                txtLNegatingLabels_LostFocus(sender, e);
            }
        }
Ejemplo n.º 3
0
 private void txtApplyFunctions_KeyUp(object sender, KeyEventArgs e)
 {
     if (TextBoxHelper.CanEvalFileOrFunction(e))
     {
         txtApplyFunctions_LostFocus(sender, e);
     }
 }
Ejemplo n.º 4
0
        /* R Global Variables */

        public void txtRVariables_KeyUp(object sender, KeyEventArgs e)
        {
            if (TextBoxHelper.CanEvalNumber((TextBox)sender, e))
            {
                txtRVariables_LostFocus(sender, e);
            }
        }
Ejemplo n.º 5
0
 private void txtRecognizeSourceFiles_KeyUp(object sender, KeyEventArgs e)
 {
     if (TextBoxHelper.CanEvalFileOrFunction(e))
     {
         txtRecognizeSourceFiles_LostFocus(sender, e);
     }
 }
Ejemplo n.º 6
0
 private void txtNegLabels_KeyUp(object sender, KeyEventArgs e)
 {
     if (TextBoxHelper.CanEvalString(e))
     {
         txtNegLabels_LostFocus(sender, null);
     }
 }
Ejemplo n.º 7
0
 private void txtVariables_KeyUp(object sender, KeyEventArgs e)
 {
     if (TextBoxHelper.CanEvalNumber(txtVariables, e))
     {
         txtVariables_LostFocus(sender, null);
     }
 }
Ejemplo n.º 8
0
 private void txtLGlobalLabels_KeyUp(object sender, KeyEventArgs e)
 {
     if (TextBoxHelper.CanEvalString(e))
     {
         var caretIndex = txtLGlobalLabels.CaretIndex;
         var origLength = txtLGlobalLabels.Text.Length;
         txtLGlobalLabels_LostFocus(sender, e);
         TextBoxHelper.SetCaret(txtLGlobalLabels, caretIndex, origLength);
     }
 }
Ejemplo n.º 9
0
 private void txtKGlobalVariables_KeyUp(object sender, KeyEventArgs e)
 {
     if (TextBoxHelper.CanEvalNumber(txtKGlobalVariables, e))
     {
         var caretIndex = txtKGlobalVariables.CaretIndex;
         var origLength = txtKGlobalVariables.Text.Length;
         //List<double> vals = DoubleCollectionConverter.convert(txtKGlobalVariables.Text);
         //txtKGlobalVariables.Text = DoubleCollectionConverter.convert(vals);
         txtKGlobalVariables_LostFocus(sender, e);
         TextBoxHelper.SetCaret(txtKGlobalVariables, caretIndex, origLength);
     }
 }
Ejemplo n.º 10
0
 private void txtKGlobalLabels_KeyUp(object sender, KeyEventArgs e)
 {
     if (TextBoxHelper.CanEvalString(e))
     {
         var caretIndex = txtKGlobalLabels.CaretIndex;
         var origLength = txtKGlobalLabels.Text.Length;
         //List<string> labels = StringCollectionConverter.convert(txtKGlobalLabels.Text);
         //txtKGlobalLabels.Text = StringCollectionConverter.convert(labels);
         txtKGlobalLabels_LostFocus(sender, e);
         TextBoxHelper.SetCaret(txtKGlobalLabels, caretIndex, origLength);
     }
 }
Ejemplo n.º 11
0
        private void txtNegLabels_LostFocus(object sender, RoutedEventArgs e)
        {
            var caretIndex = txtNegLabels.CaretIndex;
            var origLength = txtNegLabels.Text.Length;
            var lststr     = StringCollectionConverter.Convert(txtNegLabels.Text);

            ((ruleNode)firstNode).negateLabels.Clear();
            foreach (string str in lststr)
            {
                ((ruleNode)firstNode).negateLabels.Add(str);
            }
            Update();
            TextBoxHelper.SetCaret(txtNegLabels, caretIndex, origLength);
        }
Ejemplo n.º 12
0
        public void txtLNegatingLabels_LostFocus(object sender, RoutedEventArgs e)
        {
            var senderTextBox = (TextBox)sender;
            var caretIndex    = senderTextBox.CaretIndex;
            var origLength    = senderTextBox.Text.Length;
            var lststr        = StringCollectionConverter.Convert(senderTextBox.Text);

            rule.negateLabels.Clear();
            foreach (string str in lststr)
            {
                rule.negateLabels.Add(str);
            }
            Update();
            TextBoxHelper.SetCaret(senderTextBox, caretIndex, origLength);
        }
Ejemplo n.º 13
0
        public void txtRVariables_LostFocus(object sender, RoutedEventArgs e)
        {
            var senderTextBox = (TextBox)sender;
            var caretIndex    = senderTextBox.CaretIndex;
            var origLength    = senderTextBox.Text.Length;
            var lst           = DoubleCollectionConverter.Convert(senderTextBox.Text);

            rule.R.globalVariables.Clear();
            foreach (double d in lst)
            {
                rule.R.globalVariables.Add(d);
            }
            Update();
            TextBoxHelper.SetCaret(senderTextBox, caretIndex, origLength);
        }
Ejemplo n.º 14
0
        private void txtApplyFunctions_LostFocus(object sender, RoutedEventArgs e)
        {
            var senderTextBox = (TextBox)sender;
            var caretIndex    = senderTextBox.CaretIndex;
            var origLength    = senderTextBox.Text.Length;
            var lststr        = StringCollectionConverter.Convert(senderTextBox.Text);

            rule.applyFunctions.Clear();
            foreach (string str in lststr)
            {
                rule.applyFunctions.Add(str);
            }
            Update();
            senderTextBox.Text += " ";
            TextBoxHelper.SetCaret(senderTextBox, caretIndex, origLength);
            RuleParamCodeFiler.checkForFunctions(false, rule, rule.applyFunctions);
        }
Ejemplo n.º 15
0
        private void txtLabels_LostFocus(object sender, RoutedEventArgs e)
        {
            if (hyperarcs.Count == 0)
            {
                return;
            }
            MultiBindingExpression mbe;
            var caretIndex = txtLabels.CaretIndex;
            var origLength = txtLabels.Text.Length;
            var oldLabels  = firstHyperArc.localLabels;
            var newLabels  = StringCollectionConverter.Convert(txtLabels.Text);

            if ((gui is RuleDisplay) &&
                (gui == ((RuleDisplay)gui).rW.graphGUIK))
            {
                var rW   = ((RuleDisplay)gui).rW;
                var Larc = rW.rule.L.hyperarcs.Find(b => string.Equals(b.name, firstHyperArc.name));
                var Rarc = rW.rule.R.hyperarcs.Find(b => string.Equals(b.name, firstHyperArc.name));

                var removedKLabels = oldLabels.Where(a => !newLabels.Contains(a)).ToList();
                foreach (string a in removedKLabels)
                {
                    Larc.localLabels.Remove(a);
                    Rarc.localLabels.Remove(a);
                }
                var newLLabels = new List <string>(Larc.localLabels.Union(newLabels));
                Larc.localLabels.Clear();
                foreach (string a in newLLabels)
                {
                    Larc.localLabels.Add(a);
                }
                var nI = ((HyperArcShape)Larc.DisplayShape.Shape).icon;
                mbe = BindingOperations.GetMultiBindingExpression(nI, IconShape.DisplayTextProperty);
                mbe.UpdateTarget();

                var newRLabels = new List <string>(Rarc.localLabels.Union(newLabels));
                Rarc.localLabels.Clear();
                foreach (string a in newRLabels)
                {
                    Rarc.localLabels.Add(a);
                }
                nI  = ((HyperArcShape)Rarc.DisplayShape.Shape).icon;
                mbe = BindingOperations.GetMultiBindingExpression(nI, IconShape.DisplayTextProperty);
                mbe.UpdateTarget();
            }
            else if (gui is RuleDisplay)
            {
                // this is a rule LHS or RHS
                var      rW            = ((RuleDisplay)gui).rW;
                hyperarc otherHyperArc = null;
                otherHyperArc = gui == rW.graphGUIL
                    ? rW.rule.R.hyperarcs.Find(b => string.Equals(b.name, firstHyperArc.name))
                    : rW.rule.L.hyperarcs.Find(b => string.Equals(b.name, firstHyperArc.name));
                if (otherHyperArc != null)
                {
                    var Klabels = new List <string>(otherHyperArc.localLabels.Intersect(newLabels));
                    otherHyperArc =
                        rW.graphGUIK.graph.hyperarcs.Find(b => string.Equals(b.name, firstHyperArc.name));
                    otherHyperArc.localLabels.Clear();
                    foreach (string a in Klabels)
                    {
                        otherHyperArc.localLabels.Add(a);
                    }
                    var nI = ((HyperArcShape)otherHyperArc.DisplayShape.Shape).icon;
                    mbe = BindingOperations.GetMultiBindingExpression(nI, IconShape.DisplayTextProperty);
                    mbe.UpdateTarget();
                }
            }
            firstHyperArc.localLabels.Clear();
            foreach (string a in newLabels)
            {
                firstHyperArc.localLabels.Add(a);
            }
            mbe = BindingOperations.GetMultiBindingExpression(hyperArcIcon, IconShape.DisplayTextProperty);
            mbe.UpdateTarget();
            Update();
            TextBoxHelper.SetCaret(txtLabels, caretIndex, origLength);
        }
Ejemplo n.º 16
0
        private void txtVariables_LostFocus(object sender, RoutedEventArgs e)
        {
            if (hyperarcs.Count == 0)
            {
                return;
            }
            var caretIndex = txtVariables.CaretIndex;
            var origLength = txtVariables.Text.Length;
            var oldVars    = firstHyperArc.localVariables;
            var newVars    = DoubleCollectionConverter.Convert(txtVariables.Text);

            if ((gui is RuleDisplay) &&
                (gui == ((RuleDisplay)gui).rW.graphGUIK))
            {
                var rW   = ((RuleDisplay)gui).rW;
                var Larc = rW.rule.L.hyperarcs.Find(b => string.Equals(b.name, firstHyperArc.name));
                var Rarc = rW.rule.R.hyperarcs.Find(b => string.Equals(b.name, firstHyperArc.name));

                var removedKVars = oldVars.Where(a => !newVars.Contains(a)).ToList();
                foreach (double a in removedKVars)
                {
                    Larc.localVariables.Remove(a);
                    Rarc.localVariables.Remove(a);
                }
                var newLVars = new List <double>(Larc.localVariables.Union(newVars));
                Larc.localVariables.Clear();
                foreach (double a in newLVars)
                {
                    Larc.localVariables.Add(a);
                }

                var newRVars = new List <double>(Rarc.localVariables.Union(newVars));
                Rarc.localVariables.Clear();
                foreach (double a in newRVars)
                {
                    Rarc.localVariables.Add(a);
                }
            }
            else if (gui is RuleDisplay)
            {
                // this is a rule LHS or RHS
                var      rW       = ((RuleDisplay)gui).rW;
                hyperarc otherArc = null;
                otherArc = gui == rW.graphGUIL
                    ? rW.rule.R.hyperarcs.Find(b => string.Equals(b.name, firstHyperArc.name))
                    : rW.rule.L.hyperarcs.Find(b => string.Equals(b.name, firstHyperArc.name));
                if (otherArc != null)
                {
                    var KVars = new List <double>(otherArc.localVariables.Intersect(newVars));
                    otherArc =
                        rW.graphGUIK.graph.hyperarcs.Find(b => string.Equals(b.name, firstHyperArc.name));
                    otherArc.localVariables.Clear();
                    foreach (double a in KVars)
                    {
                        otherArc.localVariables.Add(a);
                    }
                }
            }
            firstHyperArc.localVariables.Clear();
            foreach (double d in newVars)
            {
                firstHyperArc.localVariables.Add(d);
            }
            Update();
            TextBoxHelper.SetCaret(txtVariables, caretIndex, origLength);
        }