예제 #1
0
        private void txtArcType_LostFocus(object sender, RoutedEventArgs e)
        {
            var newType = Type.GetType(txtHyperArcType.Text);

            if (newType == null)
            {
                newType = Type.GetType("GraphSynth." + txtHyperArcType.Text);
            }
            if (newType == null)
            {
                newType = Type.GetType("GraphSynth.Representation." + txtHyperArcType.Text);
            }
            if (newType == null)
            {
                txtHyperArcType.Text = "";
                return;
            }
            if (gui is RuleDisplay)
            {
                foreach (hyperarc a in hyperarcs)
                {
                    ((ruleHyperarc)a).TargetType = newType.ToString();
                }
            }
            else
            {
                foreach (hyperarc a in hyperarcs)
                {
                    /* make sure node is of right type - if not call the replacement function */
                    if (newType.IsInstanceOfType(a))
                    {
                        graph.replaceHyperArcWithInheritedType(a, newType);
                    }
                }
            }
            Update();
        }