Esempio n. 1
0
        private void addNodeAsRow(ElementNode node, Row parentRow)
        {
            // made the new row from the given node and add it to the control.
            TimedSequenceRowLabel label = new TimedSequenceRowLabel();
            label.Name = node.Name;
            Row newRow = TimelineControl.AddRow(label, parentRow, 32);
            newRow.ElementRemoved += ElementRemovedFromRowHandler;
            newRow.ElementAdded += ElementAddedToRowHandler;

            // Tag it with the node it refers to, and take note of which row the given element node will refer to.
            newRow.Tag = node;
            if (_elementNodeToRows.ContainsKey(node))
                _elementNodeToRows[node].Add(newRow);
            else
                _elementNodeToRows[node] = new List<Row> { newRow };

            // This slows the load down just a little, but it
            // allows the update of the load timer on the bottom of the
            // screen so Vixen doesn't appear to be locked up for very large sequences
            if (doEventsCounter % 600 == 0)
                Application.DoEvents();
            doEventsCounter++;

            // iterate through all if its children, adding them as needed
            foreach (ElementNode child in node.Children)
            {
                addNodeAsRow(child, newRow);
            }
        }
        /// <summary>
        /// Adds a single given channel node as a row in the timeline control. Recursively adds all
        /// child nodes of the given node as children, if needed.
        /// </summary>
        /// <param name="node">The node to generate a row for.</param>
        /// <param name="parentRow">The parent node the row should belong to, if any.</param>
        private void addNodeAsRow(ChannelNode node, Row parentRow)
        {
            // made the new row from the given node and add it to the control.
            TimedSequenceRowLabel label = new TimedSequenceRowLabel();
            label.Name = node.Name;
            Row newRow = timelineControl.AddRow(label, parentRow, 32);
            newRow.ElementRemoved += ElementRemovedFromRowHandler;
            newRow.ElementAdded += ElementAddedToRowHandler;

            // Tag it with the node it refers to, and take note of which row the given channel node will refer to.
            newRow.Tag = node;
            if(_channelNodeToRows.ContainsKey(node))
                _channelNodeToRows[node].Add(newRow);
            else
                _channelNodeToRows[node] = new List<Row> {newRow};

            // iterate through all if its children, adding them as needed
            foreach(ChannelNode child in node.Children) {
                addNodeAsRow(child, newRow);
            }
        }