コード例 #1
0
ファイル: ctlRule.cs プロジェクト: randomdude/Lavalamp
        public void addRuleItem(ruleItemInfo info, int x, int y)
        {
            // Create our rule item
            ruleItemBase newRuleItem = this._rule.addRuleItem(info);

            // add a visual widget for it, and then add it to the visible controls
            ctlRuleItemWidget newCtl = new ctlRuleItemWidget(newRuleItem, this.setTsStatus);
            newCtl.Location = new Point(x, y);
               //     this._rule.AddctlRuleItemWidgetToGlobalPool(newCtl);
            newCtl.snapToGrid = this.snapWidgetsToGrid;
            this.Controls.Add(newCtl);
            newCtl.BringToFront();
            this.itemWidgets.Add(newCtl);
        }
コード例 #2
0
ファイル: ctlRule.cs プロジェクト: randomdude/Lavalamp
        /// <summary>
        /// Make rule item controls for every rule item present in our rule.
        /// </summary>
        private void addRuleItemControlsAfterDeserialisation()
        {
            this.Parent.Width = this._rule.preferredWidth;
            this.Parent.Height = this._rule.preferredHeight;
            IEnumerable<IRuleItem> childRuleItems = this._rule.getRuleItems();

            foreach (ruleItemBase thisRule in childRuleItems)
            {
                ctlRuleItemWidget newCtl = new ctlRuleItemWidget(thisRule, this.setTsStatus);

                //hook up line events for deserialized control.
                foreach (var pin in newCtl.conPins.Keys.Where(p => p.isConnected))
                {
                    lineChain line = this._rule.GetLineChainFromGuid(pin.parentLineChain);
                    newCtl.OnRuleItemMoved += line.LineMoved;
                    line.onLineDeleted += pin.Disconnected;
                }
               // this._rule.AddctlRuleItemWidgetToGlobalPool(newCtl);
                newCtl.snapToGrid = this.snapWidgetsToGrid;
                this.Controls.Add(newCtl);
                newCtl.BringToFront();
                this.itemWidgets.Add(newCtl);
                if (this.onRuleItemLoaded != null)
                    this.onRuleItemLoaded.Invoke(thisRule);
            }
        }