コード例 #1
0
        private void tabControl1_PreviewMouseRightButtonUp(object sender, MouseButtonEventArgs e)
        {
            Mouse.OverrideCursor = null;

            // If "Add link" mode enabled and line drawing started (line placed to canvas)
            if (isAddNewLink && isLinkStarted)
            {
                // declare the linking state
                bool linked = false;
                // We released the button on MyThumb object
                if (e.Source.GetType() == typeof(MyThumb))
                {
                    MyThumb targetThumb = e.Source as MyThumb;
                    // define the final endpoint of line
                    link.EndPoint = e.GetPosition(canvas1);
                    // if any line was drawn (avoid just clicking on the thumb)
                    if (link.EndPoint != link.StartPoint && linkedThumb != targetThumb && linkedThumb != null)
                    {
                        // establish connection
                        linkedThumb.LinkTo(targetThumb, link);
                        // set linked state to true
                        linked = true;

                        DinamicComponentPresenter prop = new DinamicComponentPresenter();

                        Component cc = LoadedComponents[linkedThumb.Title];

                        prop.Name = cc.Name;
                        foreach (var item in cc.Items)
                        {
                            prop.val.Add(item.name, "");
                        }

                        entityfile.Components.Add(prop);

                        ComponentProperty cp = new ComponentProperty(prop);
                        cp.Name = linkedThumb.Title;

                        AddComponent(cp);
                    }
                }
                // if we didn't manage to approve the linking state
                // button is not released on MyThumb object or double-clicking was performed
                if (!linked)
                {
                    // remove line from the canvas
                    connectors.Children.Remove(link);
                    // clear the link variable
                    link = null;
                }

                // exit link drawing mode
                isLinkStarted = isAddNewLink = false;
                // configure GUI
                //btnNewAction.IsEnabled = btnNewLink.IsEnabled = true;
                Mouse.OverrideCursor = null;
                e.Handled            = true;
            }
        }
コード例 #2
0
        private void button1_Click(object sender, RoutedEventArgs e)
        {
            UIElement[] elements = new UIElement[stackPanel1.Children.Count];
            stackPanel1.Children.CopyTo(elements, 0);

            elements = elements.ToList().FindAll(p => p is TextBox).ToArray();


            //recuperando o dinamic component que vai ser gravado no arquivo
            DinamicComponentPresenter dinamic = propertie.getDinamicComponentbyName(editingcomponentname);

            foreach (var item in elements)
            {
                TextBox tt = item as TextBox;
                dinamic.val[tt.Name.Replace("_", "")] = tt.Text;
            }

            this.Close();
        }
コード例 #3
0
 public ComponentProperty(DinamicComponentPresenter pres)
 {
     this.presenter = pres;
 }