예제 #1
0
파일: MamlCreator.cs 프로젝트: mpostol/ASMD
        /// <summary>
        /// Fills the document.
        /// </summary>
        /// <param name="termWithDefinition">The term with definition.</param>
        /// <param name="tpc">The topic.</param>
        /// <param name="termCounter">The term counter.</param>
        private static void FillTheTermAndDefinitions(TermWithDefinitionStructure termWithDefinition, topic tpc, int termCounter)
        {
            tpc.developerGlossaryDocument[0].glossaryDiv[0].glossaryEntry[termCounter]                           = new glossaryEntry();
            tpc.developerGlossaryDocument[0].glossaryDiv[0].glossaryEntry[termCounter].terms                     = new term[1];
            tpc.developerGlossaryDocument[0].glossaryDiv[0].glossaryEntry[termCounter].terms[0]                  = new term();
            tpc.developerGlossaryDocument[0].glossaryDiv[0].glossaryEntry[termCounter].terms[0].termClass        = "term";
            tpc.developerGlossaryDocument[0].glossaryDiv[0].glossaryEntry[termCounter].terms[0].Value            = termWithDefinition.TermTypeName;
            tpc.developerGlossaryDocument[0].glossaryDiv[0].glossaryEntry[termCounter].definition                = new definition[1];
            tpc.developerGlossaryDocument[0].glossaryDiv[0].glossaryEntry[termCounter].definition[0]             = new definition();
            tpc.developerGlossaryDocument[0].glossaryDiv[0].glossaryEntry[termCounter].definition[0].paraOrTable = new ParaOrTable[(2 * termWithDefinition.ListOfAllTablesInTheDefinition.Count) + 2];
            definitionPara isAbstractPara = new definitionPara();

            isAbstractPara.Value = String.Format("{0}: {1}", Resources.ExportTool_IsAbstract, termWithDefinition.IsAbstract);
            tpc.developerGlossaryDocument[0].glossaryDiv[0].glossaryEntry[termCounter].definition[0].paraOrTable[1] = isAbstractPara;
            int counter = 2;

            foreach (TableStructure tab in termWithDefinition.ListOfAllTablesInTheDefinition)
            {
                definitionPara titlePara = new definitionPara();
                titlePara.Value = " - " + tab.Title;
                tpc.developerGlossaryDocument[0].glossaryDiv[0].glossaryEntry[termCounter].definition[0].paraOrTable[counter] = titlePara;
                counter++;
                tpc.developerGlossaryDocument[0].glossaryDiv[0].glossaryEntry[termCounter].definition[0].paraOrTable[counter] = MamlCreator.CreateTable(tab);
                counter++;
            }
            return;
        }
예제 #2
0
 private void FillTheTermAndDefinitions(Body body, TermWithDefinitionStructure termWithDefinition)
 {
     CreateSimpleParagraph(body, termWithDefinition.TermTypeName, styleH2_term);
     CreateSimpleParagraph(body, String.Format("{0}: {1}", Resources.ExportTool_IsAbstract, termWithDefinition.IsAbstract), style_description);
     foreach (TableStructure tab in termWithDefinition.ListOfAllTablesInTheDefinition)
     {
         //blank line:
         body.Append(new Paragraph(new Run(new Text(""))));
         // add table
         Table table = CreateTable(tab);
         //appending table to body
         body.Append(table);
     }
 }
예제 #3
0
파일: ExportTool.cs 프로젝트: mpostol/ASMD
        private static bool CheckIfExportIsPossibleAndPrepareListOfTerms(IModelNodeAdvance imna, out List <TermWithDefinitionStructure> listOfAllTerms)
        {
            if (imna == null)
            {
                MessageBox.Show(Resources.ExportTool_NoNodeIsSelected, Resources.ExportTool_Window_Name, System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Warning);
                listOfAllTerms = null;
                return(false);
            }
            listOfAllTerms = new List <TermWithDefinitionStructure>();
            if (imna.NodeType == NodeTypeEnum.ProjectNode)
            {
                foreach (IModelNodeAdvance imnaInDictionary in ((imna.GetFolders()).Values))
                {
                    if (imnaInDictionary.NodeType == NodeTypeEnum.ModelNode)
                    {
                        List <TermWithDefinitionStructure> temp_listOfAllTerms = new List <TermWithDefinitionStructure>();
                        if (CheckIfExportIsPossibleAndPrepareListOfTerms(imnaInDictionary, out temp_listOfAllTerms))
                        {
                            listOfAllTerms.AddRange(temp_listOfAllTerms);
                        }
                    }
                }
            }
            else
            {
                TermWithDefinitionStructure term = null;
                if (imna.NodeType == NodeTypeEnum.ModelNode)
                {
                    foreach (KeyValuePair <FolderType, IEnumerable <IModelNodeAdvance> > item in imna.GetFolders())
                    {
                        foreach (IModelNodeAdvance imnaInProject in item.Value)
                        {
                            term = CreateTermWithDefinition(imnaInProject);
                            if (term != null)
                            {
                                listOfAllTerms.Add(term);
                            }
                        }
                    }
                }
                else
                {
                    term = CreateTermWithDefinition(imna);
                    if (term != null)
                    {
                        listOfAllTerms.Add(term);
                        foreach (FolderType folderType in FolderType.GetValues(typeof(FolderType)))
                        {
                            if (GetFolder(imna, folderType) != null)
                            {
                                foreach (IModelNodeAdvance imnaInFolder in GetFolder(imna, folderType))
                                {
                                    term = CreateTermWithDefinition(imnaInFolder);
                                    if (term != null)
                                    {
                                        listOfAllTerms.Add(term);
                                    }
                                }
                            }
                        }
                    }
                    else
                    {
                        MessageBox.Show(Resources.ExportTool_cannot_expot_wrong_node, Resources.ExportTool_Window_Name, System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Warning);
                        return(false);
                    }
                }
            }

            return(true);
        }