Exemplo n.º 1
0
        /// <summary>
        /// dynElement constructor for use by workbench in creating dynElements
        /// </summary>
        /// <param name="settings"></param>
        /// <param name="nickName"></param>
        public dynElement()
        {
            InitializeComponent();
            //System.Uri resourceLocater = new System.Uri("/DynamoElements;component/dynElement.xaml", UriKind.Relative);
            //System.Uri resourceLocater = new System.Uri("/dynElement.xaml", UriKind.Relative);
            //System.Windows.Application.LoadComponent(this, resourceLocater);

            //set the main grid's data context to
            //this element
            nickNameBlock.DataContext = this;

            inPorts       = new List <dynPort>();
            inPortData    = new List <PortData>();
            outPortData   = new List <PortData>();
            outPorts      = new List <dynPort>();
            statePorts    = new List <dynPort>();
            statePortData = new List <PortData>();
            elements      = new ElementArray();
            dataTree      = new DataTree();
            stateSetter   = new SetStateDelegate(SetState);
            Dispatcher.Invoke(stateSetter, System.Windows.Threading.DispatcherPriority.Background, new object[] { this, ElementState.DEAD });

            ElementNameAttribute elNameAttrib = this.GetType().GetCustomAttributes(typeof(ElementNameAttribute), true)[0] as ElementNameAttribute;

            if (elNameAttrib != null)
            {
                NickName = elNameAttrib.ElementName;
            }

            //set the z index to 2
            Canvas.SetZIndex(this, 1);

            //generate a guid for the component
            dynElementReadyToBuild += new dynElementReadyToBuildHandler(Build);
        }
Exemplo n.º 2
0
        /// <summary>
        /// dynElement constructor for use by workbench in creating dynElements
        /// </summary>
        /// <param name="settings"></param>
        /// <param name="nickName"></param>
        public dynElement()
        {
            InitializeComponent();
            //System.Uri resourceLocater = new System.Uri("/DynamoElements;component/dynElement.xaml", UriKind.Relative);
            //System.Uri resourceLocater = new System.Uri("/dynElement.xaml", UriKind.Relative);
            //System.Windows.Application.LoadComponent(this, resourceLocater);

            //set the main grid's data context to
            //this element
            nickNameBlock.DataContext = this;

            inPorts = new List<dynPort>();
            inPortData = new List<PortData>();
            outPortData = new List<PortData>();
            outPorts = new List<dynPort>();
            statePorts = new List<dynPort>();
            statePortData = new List<PortData>();
            elements = new ElementArray();
            dataTree = new DataTree();
            stateSetter = new SetStateDelegate(SetState);
            Dispatcher.Invoke(stateSetter, System.Windows.Threading.DispatcherPriority.Background, new object[] {this, ElementState.DEAD });

            ElementNameAttribute elNameAttrib = this.GetType().GetCustomAttributes(typeof(ElementNameAttribute), true)[0] as ElementNameAttribute;
            if (elNameAttrib != null)
            {
                NickName = elNameAttrib.ElementName;
            }

            //set the z index to 2
            Canvas.SetZIndex(this, 1);

            //generate a guid for the component
            dynElementReadyToBuild += new dynElementReadyToBuildHandler(Build);
        }