/// <summary>
        /// Initializes a new instance of the <see cref="NumberPropertyControl"/> class.
        /// </summary>
        /// <param name="property">The property.</param>
        /// <param name="isConnectable">if set to <c>true</c> [is connectable].</param>
        public NumberPropertyControl(ns.Base.Plugins.Properties.Property property, bool isConnectable)
            : base(property)
        {
            InitializeComponent();
            IsConnectable = isConnectable;
            this.NameLabel.Content = property.Name;
            _property = property;

            if (!string.IsNullOrEmpty(Property.ConnectedToUID)) {
                ConnectClicked(this.ContentGrid as Panel, this.ConnectImage);
            } else {
                if (property is IntegerProperty) {
                    this.NumberBox.Text = ((int)property.Value).ToString();
                } else if (property is DoubleProperty) {
                    this.NumberBox.Text = ((double)property.Value).ToString();
                } else {
                    Trace.WriteLine("Wrong property type " + property.GetType() + " in " + MethodInfo.GetCurrentMethod() + "!", LogCategory.Error);
                }
            }
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="RectanglePropertyControl"/> class.
        /// </summary>
        /// <param name="property">The property.</param>
        /// <param name="isConnectable">if set to <c>true</c> [is connectable].</param>
        public RectanglePropertyControl(ns.Base.Plugins.Properties.Property property, bool isConnectable)
            : base(property)
        {
            InitializeComponent();
            IsConnectable = isConnectable;
            this.NameLabel.Content = property.Name;
            _property = property;
            property.PropertyChanged += Property_PropertyChanged;

            if (!string.IsNullOrEmpty(Property.ConnectedToUID)) {
                ConnectClicked(this.ContentGrid as Panel, this.ConnectImage);
            } else {
                if (property is RectangleProperty) {
                    RectangleProperty rectangleProperty = property as RectangleProperty;
                    this.XNumberBox.Text = rectangleProperty.X.ToString();
                    this.YNumberBox.Text = rectangleProperty.Y.ToString();
                    this.WidthNumberBox.Text = rectangleProperty.Width.ToString();
                    this.HeightNumberBox.Text = rectangleProperty.Height.ToString();

                } else {
                    Trace.WriteLine("Wrong property type " + property.GetType() + " in " + MethodInfo.GetCurrentMethod() + "!", LogCategory.Error);
                }
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Adds the specified property.
        /// </summary>
        /// <param name="propertyType">The property.</param>
        /// <returns></returns>
        public bool AddType(Property propertyType)
        {
            bool result = false;

            if ((result = !_propertyTypes.Contains(propertyType)) == true) {
                _propertyTypes.Add(propertyType);
                Trace.WriteLine("Property type added: " + propertyType.ToString(), LogCategory.Debug);
            }

            return result;
        }
Exemplo n.º 4
0
        /// <summary>
        /// Gets the target properties.
        /// </summary>
        /// <param name="property">The property.</param>
        /// <param name="targetTool">The target tool.</param>
        /// <param name="parent">The parent.</param>
        /// <returns></returns>
        private List<Property> GetTargetProperties(Property property, Tool targetTool, Node parent)
        {
            List<ns.Base.Plugins.Properties.Property> properties = new List<ns.Base.Plugins.Properties.Property>();

            foreach (Node node in parent.Childs) {
                if (node == targetTool) break;

                if (node is Property) {
                    ns.Base.Plugins.Properties.Property prop = node as ns.Base.Plugins.Properties.Property;
                    if (prop.IsOutput && (prop.Parent is Tool || prop.Parent is Operation) && property.GetType() == prop.GetType())
                        properties.Add(prop);
                }

                properties.AddRange(GetTargetProperties(property, targetTool, node));
            }

            return properties;
        }
Exemplo n.º 5
0
        /// <summary>
        /// Gets the connectable properties.
        /// </summary>
        /// <param name="property">The property.</param>
        /// <returns></returns>
        public List<Property> GetConnectableProperties(Property property)
        {
            Node mainParent = null;
            Node tmpParent = null;
            Tool toolParent = null;
            Tool mainToolParent = null;

            List<Property> result = null;

            while (tmpParent == null || tmpParent.Parent != null) {
                if (tmpParent == null)
                    tmpParent = property.Parent;
                else
                    tmpParent = tmpParent.Parent;

                if (tmpParent is Tool && toolParent == null)
                    toolParent = tmpParent as Tool;
            }

            if (toolParent != null) {
                while (mainToolParent == null || mainToolParent.Parent is Tool) {
                    if (mainToolParent == null)
                        mainToolParent = toolParent;
                    else if (mainToolParent.Parent is Tool) {
                        mainToolParent = mainToolParent.Parent as Tool;
                    }
                }
            }

            mainParent = tmpParent;

            result = GetTargetProperties(property, mainToolParent, mainParent);

            return result;
        }
Exemplo n.º 6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PropertyControl"/> class.
 /// </summary>
 /// <param name="property">The property.</param>
 public PropertyControl(ns.Base.Plugins.Properties.Property property)
     : base()
 {
     _property = property;
 }