예제 #1
0
        public override object Copy()
        {
            RoomNode node = base.Copy() as RoomNode;

            node.SetText(node.Title);
            return(node);
        }
예제 #2
0
        public override object Clone()
        {
            RoomNode node = base.Clone() as RoomNode;

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

            return(node);
        }
예제 #3
0
        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);
        }
예제 #4
0
        /// <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);
        }
예제 #5
0
        private static PageNode ImportPageNode(BackgroundWorker worker, RoomNode roomNode, KNXPage page, string ResImgDir)
        {
            PageNode pageNode = new PageNode(page, worker, ResImgDir);

            foreach (KNXControlBase knx in page.Controls)
            {
                ImportControlNode(worker, pageNode, knx, ResImgDir);
            }

            if (null != roomNode)
            {
                roomNode.Nodes.Add(pageNode);
            }

            return(pageNode);
        }
예제 #6
0
        private static KNXRoom ExportRoom(BackgroundWorker worker, KNXArea area, RoomNode node, string ImgResDir)
        {
            KNXRoom room = node.ExportTo(worker, ImgResDir);

            foreach (PageNode cNode in node.Nodes)
            {
                ExportPage(worker, room, cNode, ImgResDir);
            }

            if (null != area)
            {
                area.Rooms.Add(room);
            }

            return(room);
        }
예제 #7
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;
        }