public void ReLoadTree() { cancheck = false; ProTree.Nodes.Clear(); TreeNode root = new TreeNode(); root.Text = AppConf.Ins.Application.AppName; root.Tag = AppConf.Ins.Application; ProTree.Nodes.Add(root); TreeNode moduleNode, entityNode; foreach (ModuleInfo module in AppConf.Ins.Application.Modules) { moduleNode = new TreeNode(module.ModuleName + "[" + module.Caption +"," + module.Prefix+ "]"); moduleNode.Tag = module; root.Nodes.Add(moduleNode); foreach (EntityInfo entity in module.Entitys) { entityNode = new TreeNode(entity.EntityName + "[" + entity.ClassName + ",ops:" + entity.operaters.Count + "]"); entityNode.Tag = entity; moduleNode.Nodes.Add(entityNode); } CheckedModule = module; } ProTree.ExpandAll(); //ProTree.AfterSelect += ProTree_AfterSelect; cancheck = true; }
public ModuleInfo Clone() { ModuleInfo module = new ModuleInfo(); module.ModuleName = this.ModuleName; module.Caption = this.Caption; module.ModuleType = this.ModuleType; module.Prefix = this.Prefix; module.Suffix = this.Suffix; return module; }
private void btnAddModule_Click(object sender, EventArgs e) { if (mods == null) { ModuleInfo module = new ModuleInfo(); module.ModuleName = txModuleName.Text; module.Prefix = txPrefix.Text; module.Suffix = txSuffix.Text; module.Caption = txCaption.Text; module.ModuleType = txType.Text; AppConf.Ins.Application.Modules.Add(module); } else { mods.ModuleName = txModuleName.Text; mods.Prefix = txPrefix.Text; mods.Suffix = txSuffix.Text; mods.Caption = txCaption.Text; mods.ModuleType = txType.Text; } ProTreeCtrl.Ins.ReLoadTree(); this.Close(); }
public void ReLoadTree() { CHECKTree.Nodes.Clear(); root = new TreeNode(); root.Text = AppConf.Ins.Application.AppName; root.Tag = AppConf.Ins.Application; CHECKTree.Nodes.Add(root); TreeNode moduleNode, entityNode; foreach (ModuleInfo module in AppConf.Ins.Application.Modules) { moduleNode = new TreeNode(module.ModuleName + "[" + module.Caption + "," + module.Prefix + "]"); moduleNode.Tag = module; root.Nodes.Add(moduleNode); foreach (EntityInfo entity in module.Entitys) { entityNode = new TreeNode(entity.EntityName + "[" + entity.ClassName + ",ops:" + entity.operaters.Count + "]"); entityNode.Tag = entity; moduleNode.Nodes.Add(entityNode); } CheckedModule = module; } CHECKTree.NodeMouseClick += CHECKTree_NodeMouseClick; CHECKTree.AfterCheck += CHECKTree_AfterCheck; CHECKTree.NodeMouseDoubleClick += CHECKTree_NodeMouseDoubleClick; CHECKTree.CheckBoxes = true; CHECKTree.ExpandAll(); }
public void ProTree_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e) { if (cancheck) { if (ProTree.SelectedNode.Tag is ModuleInfo) { CheckedModule = ProTree.SelectedNode.Tag as ModuleInfo; ReloadModule(); } if (ProTree.SelectedNode.Tag is EntityInfo) { Checkedentity = ProTree.SelectedNode.Tag as EntityInfo; //formConf.Editedtable = Checkedentity; FMEntityEditor editor = new FMEntityEditor(); editor.entity = Checkedentity; editor.WindowState = FormWindowState.Maximized; editor.RefreshModeltable += ClassDiagCtrl.Ins.editor_RefreshModeltable; editor.ShowDialog(); //MessageBox.Show(Checkedentity.EntityName); } } }
/// <summary> /// 模拟选中当前模型. /// </summary> /// <param name="module"></param> public void CheckModule(ModuleInfo module) { foreach (TreeNode tr in ProTree.Nodes[0].Nodes) { if (tr.Tag.Equals(module)) { ProTree.SelectedNode = tr; } } ProTree_AfterSelect(null, null); }
/// <summary> /// 从数据库内导入,前提,之前操作的记录都有保存. /// </summary> /// <param name="entities"></param> public void LoadFromDatabase(List<EntityInfo> entities, ModuleInfo mod) { AppConf.Ins.views_enkey = new Dictionary<EntityInfo, Table>(); AppConf.Ins.views_tbkey = new Dictionary<Table, EntityInfo>(); //AppConf.Ins.Application = null; ProTreeCtrl.Ins.ReLoadTree(); int i = 0; int X = 20; int Y = 70; foreach (EntityInfo _entity in entities) { i++; X += 180; if (i % 6 == 0) { Y += 100; X = 20; } _entity.X = X; _entity.Y = Y; mod.Entitys.Add(_entity); NewTable(currentModel, _entity); } ProTreeCtrl.Ins.ReLoadTree(); }
public void LoadFromModuleInfo(ModuleInfo module) { foreach (EntityInfo _entity in module.Entitys) { NewTable(currentModel, _entity); } }