Пример #1
0
        private void CleanupOldPorts()
        {
            //clear all the inputs but the first one
            //which is the family instance
            //first kill all the connectors
            for (int i = 1; i < InPortData.Count; i++)
            {
                dynPort p = InPorts[i];

                //must remove the connectors iteratively
                //do not use a foreach here!
                while (p.Connectors.Count > 0)
                {
                    dynConnector c = p.Connectors[p.Connectors.Count - 1] as dynConnector;
                    c.Kill();
                }
            }

            //then remove all the ports
            while (InPorts.Count > 1)
            {
                InPorts.RemoveAt(InPorts.Count - 1);
                InPortData.RemoveAt(InPortData.Count - 1);
            }

            while (gridLeft.RowDefinitions.Count > 1)
            {
                //remove the port from the children list
                gridLeft.Children.RemoveAt(gridLeft.RowDefinitions.Count - 1);
                gridLeft.RowDefinitions.RemoveAt(gridLeft.RowDefinitions.Count - 1);
            }
        }
Пример #2
0
        /// <summary>
        /// Removes an input from this node. Called when the '-' button is clicked.
        /// </summary>
        protected virtual void RemoveInput()
        {
            var count = InPortData.Count;

            if (count > 0)
            {
                InPortData.RemoveAt(count - 1);
            }
            UpdateRecalcState();
        }
Пример #3
0
        protected override void RemoveInput()
        {
            var count = InPortData.Count;

            if (count > 0)
            {
                InPortData.RemoveAt(count - 1);

                //this node will always have one input
                //so the inputs collection will be one larger
                //than the outputs
                OutPortData.RemoveAt(count - 2);
            }
        }
Пример #4
0
        /// <summary>
        ///     It removes all the in ports and out ports so that the user knows there is an error.
        /// </summary>
        /// <param name="errorMessage"> Error message to be displayed </param>
        private void ProcessError()
        {
            dynSettings.Controller.DynamoLogger.Log("Error in Code Block Node");

            //Remove all ports
            int size = InPortData.Count;

            for (int i = 0; i < size; i++)
            {
                InPortData.RemoveAt(0);
            }
            size = OutPortData.Count;
            for (int i = 0; i < size; i++)
            {
                OutPortData.RemoveAt(0);
            }
            RegisterAllPorts();

            previewVariable = null;
        }