Beispiel #1
0
        public int GetAppNodeHeight()
        {
            if (MyConst.View.KnxAppType == this.Name)
            {
                //return this.Height;
                return(this.Size.Height);
            }

            if (null == this.Parent)
            {
                return(-1);
            }

            AppNode parentNode = this.Parent as AppNode;

            if (null != parentNode)
            {
                return(GetAppNodeHeight());
            }
            else
            {
                //return parentNode.Height;
                return(parentNode.Size.Height);
            }
        }
Beispiel #2
0
        public override object Copy()
        {
            AppNode node = base.Copy() as AppNode;

            node.SetText(node.Title);
            return(node);
        }
Beispiel #3
0
        public override object Clone()
        {
            AppNode node = base.Clone() as AppNode;

            node.About  = this.About;
            node.Logo   = this.Logo;
            node.Symbol = this.Symbol;
            return(node);
        }
Beispiel #4
0
        public override object Clone()
        {
            AppNode node = base.Clone() as AppNode;

            node.About           = this.About;
            node.Symbol          = this.Symbol;
            node.BackgroundImage = this.BackgroundImage;
            return(node);
        }
        private static AppNode ImportAppNode(BackgroundWorker worker, KNXApp app, string ResImgDir)
        {
            AppNode appNode = new AppNode(app, worker, ResImgDir);

            foreach (KNXArea knx in app.Areas)
            {
                ImportAreaNode(worker, appNode, knx, ResImgDir);
            }
            return(appNode);
        }
        private static KNXApp ExportApp(BackgroundWorker worker, AppNode node, string ImgResDir)
        {
            KNXApp app = node.ExportTo(worker, ImgResDir);

            foreach (AreaNode cNode in node.Nodes)
            {
                ExportArea(worker, app, cNode, ImgResDir);
            }

            return(app);
        }
        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);
        }
        /// <summary>
        /// 导出树形结构为json文件
        /// </summary>
        /// <param name="tvwAppdata"></param>
        /// <param name="fileName"></param>
        public static KNXApp ExportAppNodeAndResources(AppNode appNode, BackgroundWorker worker)
        {
            KNXApp app = new KNXApp();

            if (appNode != null)
            {
                app = appNode.ToKnx(worker);
                if (appNode.Nodes.Count > 0)
                {
                    foreach (TreeNode it1 in appNode.Nodes)
                    {
                        #region 添加区域
                        if (MyConst.View.KnxAreaType == it1.Name)
                        {
                            var areaNode = it1 as AreaNode;
                            if (areaNode != null)
                            {
                                var area = areaNode.ToKnx(worker);
                                app.Areas.Add(area);

                                if (it1.Nodes.Count > 0)
                                {
                                    #region 添加房间
                                    foreach (TreeNode it2 in it1.Nodes)
                                    {
                                        if (MyConst.View.KnxRoomType == it2.Name)
                                        {
                                            var roomNode = it2 as RoomNode;
                                            if (roomNode != null)
                                            {
                                                var room = roomNode.ToKnx(worker);
                                                area.Rooms.Add(room);

                                                if (it2.Nodes.Count > 0)
                                                {
                                                    #region 添加页面
                                                    foreach (TreeNode it3 in it2.Nodes)
                                                    {
                                                        if (MyConst.View.KnxPageType == it3.Name)
                                                        {
                                                            var pageNode = it3 as PageNode;
                                                            if (pageNode != null)
                                                            {
                                                                #region 添加页面
                                                                PageNode mPageNode = pageNode.GetTwinsPageNode();
                                                                if (null != mPageNode)
                                                                {
                                                                    var page = mPageNode.ToKnx(worker);
                                                                    room.Pages.Add(page);

                                                                    if (mPageNode.Nodes.Count > 0)
                                                                    {
                                                                        // 添加 grid
                                                                        foreach (TreeNode it4 in mPageNode.Nodes)
                                                                        {
                                                                            ExportControls(page, it4, worker);
                                                                        }
                                                                    }
                                                                }
                                                                #endregion
                                                            }
                                                        }
                                                    }
                                                    #endregion
                                                }
                                            }
                                        }
                                    }
                                    #endregion
                                }
                            }
                        }
                        #endregion
                    }
                }
            }

            return(app);
        }
Beispiel #10
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;
        }
Beispiel #11
0
 private void SetProjectOutline(AppNode node)
 {
     this.ucdo.SetOutlineNode(node);
     this.ucdo.Title = ResourceMng.GetString("DocumentOutline") + "-" + node.Text;
 }