Beispiel #1
0
        private void listBox1_DoubleClick(object sender, EventArgs e)
        {
            DesignControl  dc = ((DesignControl)elementHost1.Child);
            ContentControl cc = new ContentControl();

            cc.Content  = Activator.CreateInstance(((ComponentListItem)listBox1.SelectedItem).Control);
            cc.Template = dc.FindResource("DesignerItemTemplate") as ControlTemplate;
            Canvas.SetTop(cc, 10);
            Canvas.SetLeft(cc, 50);
            dc.Canvas.Children.Add(cc);
        }
Beispiel #2
0
        private void startSimulationToolStripMenuItem_Click(object sender, EventArgs e)
        {
            DesignControl dc = ((DesignControl)elementHost1.Child);

            foreach (System.Windows.UIElement uie in dc.Canvas.Children)
            {
                if (uie.GetType() == typeof(ContentControl))
                {
                    ContentControl cc = uie as ContentControl;
                    if (cc.Content.GetType() == typeof(L))
                    {
                        L l = cc.Content as L;
                        foreach (Connection c1 in l.Ports)
                        {
                            foreach (Connection c in c1.ConnectedTo)
                            {
                                Console.WriteLine(c.Component);
                            }
                        }
                    }
                }
            }
        }