示例#1
0
        public override object Copy()
        {
            AreaNode node = base.Copy() as AreaNode;

            node.SetText(node.Title);
            return(node);
        }
示例#2
0
        public override object Clone()
        {
            AreaNode node = base.Clone() as AreaNode;

            node.Symbol  = this.Symbol;
            node.PinCode = this.PinCode;

            return(node);
        }
        private static RoomNode ImportRoomNode(BackgroundWorker worker, AreaNode areaNode, KNXRoom room, string ResImgDir)
        {
            RoomNode roomNode = new RoomNode(room, worker, ResImgDir);

            foreach (KNXPage knx in room.Pages)
            {
                ImportPageNode(worker, roomNode, knx, ResImgDir);
            }
            if (null != areaNode)
            {
                areaNode.Nodes.Add(roomNode);
            }

            return(roomNode);
        }
        private static AreaNode ImportAreaNode(BackgroundWorker worker, AppNode appNode, KNXArea area, string ResImgDir)
        {
            AreaNode areaNode = new AreaNode(area, worker, ResImgDir);

            foreach (KNXRoom knx in area.Rooms)
            {
                ImportRoomNode(worker, areaNode, knx, ResImgDir);
            }
            if (null != appNode)
            {
                appNode.Nodes.Add(areaNode);
            }

            return(areaNode);
        }
        /// <summary>
        /// 导入 JSON 文件,生成 Treeview 节点
        /// </summary>
        /// <param name="app"></param>
        /// <param name="tvwAppdata"></param>
        public static AppNode ImportNode(KNXApp app, BackgroundWorker worker)
        {
            AppNode appNode = null;

            if (app != null)
            {
                appNode = new AppNode(app, worker);
                if (app.Areas != null && app.Areas.Count > 0)
                {
                    foreach (KNXArea itemArea in app.Areas)
                    {
                        var areaNode = new AreaNode(itemArea, worker);
                        appNode.Nodes.Add(areaNode);

                        if (itemArea.Rooms != null && itemArea.Rooms.Count > 0)
                        {
                            foreach (KNXRoom itemRoom in itemArea.Rooms)
                            {
                                var roomNode = new RoomNode(itemRoom, worker);
                                areaNode.Nodes.Add(roomNode);

                                if (itemRoom.Pages != null && itemRoom.Pages.Count > 0)
                                {
                                    foreach (KNXPage itemPage in itemRoom.Pages)
                                    {
                                        var pageNode = new PageNode(itemPage, worker);
                                        roomNode.Nodes.Add(pageNode);

                                        PageNode pageNodeClone = pageNode.CreateTwinsPageNode();

                                        // 给页面添加控件
                                        if (itemPage.Controls != null && itemPage.Controls.Count > 0)
                                        {
                                            foreach (var item in itemPage.Controls)
                                            {
                                                AddControlNode(pageNodeClone, item, worker);
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }

            return(appNode);
        }
        private static KNXArea ExportArea(BackgroundWorker worker, KNXApp app, AreaNode node, string ImgResDir)
        {
            KNXArea area = node.ExportTo(worker, ImgResDir);

            foreach (RoomNode cNode in node.Nodes)
            {
                ExportRoom(worker, area, cNode, ImgResDir);
            }

            if (null != app)
            {
                app.Areas.Add(area);
            }

            return(area);
        }
示例#7
0
        public override object Clone()
        {
            AreaNode node = base.Clone() as AreaNode;

            return(node);
        }
示例#8
0
        /// <summary>
        /// 导入 JSON 文件,生成 Treeview 节点
        /// </summary>
        /// <param name="app"></param>
        /// <param name="tvwAppdata"></param>
        public static AppNode ImportNode(KNXApp app/*, TreeView tv, UIEditor.Entity.ViewNode.PropertiesChangedDelegate proChangedDelegate*/)
        {
            AppNode appNode = null;

            if (app != null)
            {
                //tvwAppdata.BeginUpdate();
                //tvwAppdata.Nodes.Clear();

                appNode = new AppNode(app);

                //tvwAppdata.Nodes.Add(appNode);

                if (app.Areas != null && app.Areas.Count > 0)
                {
                    foreach (KNXArea itemArea in app.Areas)
                    {
                        var areaNode = new AreaNode(itemArea);
                        appNode.Nodes.Add(areaNode);

                        if (itemArea.Rooms != null && itemArea.Rooms.Count > 0)
                        {
                            foreach (KNXRoom itemRoom in itemArea.Rooms)
                            {
                                var roomNode = new RoomNode(itemRoom);
                                areaNode.Nodes.Add(roomNode);

                                if (itemRoom.Pages != null && itemRoom.Pages.Count > 0)
                                {
                                    foreach (KNXPage itemPage in itemRoom.Pages)
                                    {
                                        var pageNode = new PageNode(itemPage);
                                        //pageNode.PropertiesChangedEvent += proChangedDelegate;
                                        roomNode.Nodes.Add(pageNode);

                                        // 给页面添加控件
                                        if (itemPage.Controls != null && itemPage.Controls.Count > 0)
                                        {
                                            foreach (var item in itemPage.Controls)
                                            {
                                                AddControlNode(pageNode, item/*, proChangedDelegate*/);
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }

                }

                //tvwAppdata.EndUpdate();
            }

            return appNode;
        }