private void btAddCont_Click(object sender, EventArgs e) { var nodeToAddTo = treeView1.SelectedNode as AsmNode; if (nodeToAddTo == null) { return; } if (!nodeToAddTo.Assembly.IsDataContainer) { return; } var result = Utils.InputBox("Создание контейнера", "Введите имя контейнера:", Session.DefaultContainerName); if (String.IsNullOrEmpty(result)) { return; } var ParentContID = nodeToAddTo.Assembly.BlockID; var asm = store.CreateContainer(result, ParentContID); var aNode = new AsmNode(asm); nodeToAddTo.Nodes.Add(aNode); }
/// <summary> /// Поиск узла справочника в дереве /// </summary> /// <param name="DictID">ID справочника в БД</param> private TreeNode FindDict(long DictID) { AsmNode DictsStore = null; foreach (AsmNode node in treeView1.Nodes) { if (node.Assembly.BlockID == Session.DictsStoreID) { DictsStore = node; break; } } if (DictsStore == null) { return(null); } foreach (AsmNode node in DictsStore.Nodes) { if (node.Assembly.BlockID == DictID) { return(node); } } return(null); }
/// <summary> /// Заполнение узлами первого уровня дерева /// </summary> private void PopulateTreeView() { treeView1.Nodes.Clear(); foreach (var cont in store.containers) { var aNode = new AsmNode(cont); PopulateChildrenTree(cont, aNode); treeView1.Nodes.Add(aNode); } }
public void RefreshAsm(AsmNode aNode) { //TODO обновить здесь и все остальные поля if (aNode.NodeType == clNodeType.clnDocument) { var nd = new DocumentAsm(aNode.Assembly); aNode.Assembly = nd; } store.AsmFillChildren(aNode.Assembly); }
/// <summary> /// Заполнение узла дочерними узлами /// </summary> private void PopulateChildrenTree(AssemblyBase asm, AsmNode nodeToAddTo) { foreach (var chld in asm.Children) { if (FindNode(chld.BlockID, nodeToAddTo) != null) { continue; } var aNode = new AsmNode(chld, chld.Name); nodeToAddTo.Nodes.Add(aNode); } }
private void EditNode(AsmNode aNode) { if (aNode == null) { return; } switch (aNode.NodeType) { case clNodeType.clnParagraph: { var fParaEdit = new FormParaEdit(aNode, treeOper.toEdit); fParaEdit.Show(); break; } } }
private void btAddLemma_Click(object sender, EventArgs e) { var nodeToAddTo = FindDict(Session.DictLemmsID); if (nodeToAddTo == null) { return; } var result = Utils.InputBox("Добавление леммы", "Введите лемму:", ""); if (String.IsNullOrEmpty(result)) { return; } var asm = store.CreateLexema((long)GrenPart.NOUN_ru, result); var aNode = new AsmNode(asm); nodeToAddTo.Nodes.Add(aNode); }
private void btAddDoc_Click(object sender, EventArgs e) { var nodeToAddTo = treeView1.SelectedNode as AsmNode; if (nodeToAddTo == null) { return; } var result = Utils.InputBox("Создание документа", "Введите имя документа:", Session.DefaultDocumentName); if (String.IsNullOrEmpty(result)) { return; } var ParentNodeID = nodeToAddTo.Assembly.BlockID; var asm = store.CreateDocument(result, ParentNodeID); var aNode = new AsmNode(asm); nodeToAddTo.Nodes.Add(aNode); }
public FormParaEdit(AsmNode theNode, treeOper tOper) { InitializeComponent(); this.theNode = theNode; this.typeOper = tOper; AssemblyBase asm = null; switch (tOper) { case (treeOper.toEdit): asm = theNode.Assembly; break; case (treeOper.toAdd): asm = store.CreateParagraph(theNode.Assembly.BlockID); break; } this.paraAsm = new ParagraphAsm(asm); }
private void btAddDict_Click(object sender, EventArgs e) { var nodeToAddTo = treeView1.SelectedNode as AsmNode; if (nodeToAddTo == null) { return; } /// TODO Здесь надо делать диалог и помимо имени выбирать тип элементов var result = Utils.InputBox("Создание справочника", "Введите имя справочника:", Session.DefaultDictionaryName); if (String.IsNullOrEmpty(result)) { return; } var ParentNodeID = nodeToAddTo.Assembly.BlockID; var asm = store.CreateDictionary(result, ParentNodeID); var aNode = new AsmNode(asm); nodeToAddTo.Nodes.Add(aNode); }