Ejemplo n.º 1
0
        private void CreateHhc(TreeNodeCollection nodeCollection, Hhc hhc, Content contentDataSet)
        {
            var opened = false; // Keep track of opening or closing of TOC entries

            foreach (TreeNode node in nodeCollection)
            {
                Debug.Assert(node != null, "node is null");

                if (node.Checked)
                {
                    var mtpsNode = node.Tag as MtpsNode;

                    Debug.Assert(mtpsNode != null, "mtpsNode != null");

                    var row = contentDataSet.Tables[TableNames.ITEM].Rows.Find(mtpsNode.TargetAssetId);


                    var url = Path.Combine(CHM_SUB_DIR, row[ColumnNames.CONTENTID] + ApplicationStrings.FILE_EXTENSION_HTM);

                    // Save the first page we see in the TOC as the default page as required by the chm.
                    if (_defaultPage == null)
                    {
                        _defaultPage = url;
                    }


                    hhc.WriteStartNode(mtpsNode.Title, url);

                    opened = true;
                }

                if (node.Nodes.Count != 0 || node.Tag != null)
                {
                    CreateHhc(node.Nodes, hhc, contentDataSet);
                }

                if (opened)
                {
                    opened = false;
                    hhc.WriteEndNode();
                }
            }
        }
Ejemplo n.º 2
0
        private void CreateHhc(TreeNodeCollection nodeCollection, Hhc hhc, Content contentDataSet)
        {
            var opened = false; // Keep track of opening or closing of TOC entries

            foreach (TreeNode node in nodeCollection)
            {
                Debug.Assert(node != null, "node is null");

                if (node.Checked)
                {
                    var mtpsNode = node.Tag as MtpsNode;

                    Debug.Assert(mtpsNode != null, "mtpsNode != null");

                    var row = contentDataSet.Tables[TableNames.ITEM].Rows.Find(mtpsNode.TargetAssetId);

                    var url = Path.Combine(CHM_SUB_DIR, row[ColumnNames.CONTENTID] + ApplicationStrings.FILE_EXTENSION_HTM);

                    // Save the first page we see in the TOC as the default page as required by the chm.
                    if (_defaultPage == null)
                        _defaultPage = url;

                    hhc.WriteStartNode(mtpsNode.Title, url);

                    opened = true;
                }

                if (node.Nodes.Count != 0 || node.Tag != null)
                {
                    CreateHhc(node.Nodes, hhc, contentDataSet);
                }

                if (opened)
                {
                    opened = false;
                    hhc.WriteEndNode();
                }
            }
        }