public void CopyPageNode() { PageNode pageNodeClone = this.Tag as PageNode; if (null != pageNodeClone) { PageNode pageNodeCopy = pageNodeClone.Copy() as PageNode; this.Text = pageNodeCopy.Text; this.Tag = pageNodeCopy; pageNodeCopy.Tag = this; } }
public void SetNewTitle(string title) { this.Title = title; SetText(title); PageNode node = this.Tag as PageNode; if (null != node) { node.Text = this.Text; node.Title = this.Title; } }
public void SetNewSize(Size size) { //this.Width = width; //this.Height = height; this.Size = size; PageNode node = this.Tag as PageNode; if (null != node) { //node.Width = width; //node.Height = height; node.Size = size; } }
/// <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 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); }
private static KNXPage ExportPage(BackgroundWorker worker, KNXRoom room, PageNode node, string ImgResDir) { KNXPage page = node.ExportTo(worker, ImgResDir); foreach (ViewNode cNode in node.Nodes) { ExportControl(worker, page, cNode, ImgResDir, Point.Empty); } if (null != room) { room.Pages.Add(page); } return(page); }
public STPage(PageNode node) : base(node) { this.Location = new Point(0, 0); this.BackgroundImageLayout = ImageLayout.Stretch; this.AutoScroll = true; this.ChangeSize(); this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.Panel_MouseDown); this.MouseMove += new System.Windows.Forms.MouseEventHandler(this.Panel_MouseMove); this.MouseUp += new System.Windows.Forms.MouseEventHandler(this.Panel_MouseUp); this.SelectedNodes = new List<ViewNode>(); this.ContainsPointNodes = new List<ViewNode>(); this.CtrlDown = false; this.Changed = false; this.node.panel = this; }
/// <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); }
/// <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; }
private void CreateTabPage(PageNode node) { TabPage page = this.tabControl.TabPages[node.Id.ToString()]; if (null != page) { this.tabControl.SelectedTab = page; } else { this.tabControl.TabPages.Add(node.Id.ToString(), node.Text); page = this.tabControl.TabPages[node.Id.ToString()]; ContextMenuStrip cms = new ContextMenuStrip(); page.ContextMenuStrip = cms; page.AutoScroll = true; STPage panel = new STPage(node); panel.cqp = this.cqdo; panel.ControlSelectedEvent += new UIEditor.SationUIControl.STPage.ControlSelectedEventDelegate(this.STPage_ControlChangedEvent); //panel.ControlDeleteEvent += new UIEditor.SationUIControl.STPage.ControlDeleteEventDelegate(this.STPage_ControlDeleteEvent); panel.PageChangedEvent += new UIEditor.SationUIControl.STPage.PageChangedEventDelegate(this.STPage_PageChangedEvent); page.Controls.Add(panel); } page.Tag = node; this.tabControl.SelectedTab = page; this.curPageNode = node; this.curSTPage = node.panel as STPage; CheckTabControl(); }
private bool ErgodicPageNode(TreeNode p, PageNode pageNode) { foreach (TreeNode c in p.Nodes) { ViewNode cNode = c as ViewNode; if (MyConst.View.KnxPageType == cNode.Name) { if (cNode.Id == pageNode.Id) { return true; } } else if ((MyConst.View.KnxAppType == cNode.Name) || (MyConst.View.KnxAreaType == cNode.Name) || (MyConst.View.KnxRoomType == cNode.Name)) { if (ErgodicPageNode(cNode, pageNode)) { return true; } } } return false; }
private void ResetParameter() { this.curPageNode = null; this.curSelectedNode = null; if (null != this.curSTPage) { this.curSTPage.Parent.Controls.Remove(this.curSTPage); this.curSTPage = null; } //this.curSTPanel = null; //this.curFrameControl = null; MyCache.ResetVariable(); }
public override object Clone() { PageNode node = base.Clone() as PageNode; return(node); }