Пример #1
0
        private static void AddHiddenRegions(AuthoringSink sink, IEnumerable <AstNode> content)
        {
            foreach (AstNode astNode in content)
            {
                if ((astNode is XmlElement || astNode is NVForeachDirective) &&
                    (astNode.Position.StartLine < astNode.Position.EndLine))
                {
//                    NewHiddenRegion region = new NewHiddenRegion();
//                    region.dwBehavior = (uint)HIDDEN_REGION_BEHAVIOR.hrbEditorControlled;
//                    region.dwState = (uint)HIDDEN_REGION_STATE.hrsExpanded;
//                    region.iType = (int)HIDDEN_REGION_TYPE.hrtCollapsible;
//                    region.pszBanner = "..." + xmlElement.Name + "...";

                    TextSpan hiddenTextSpan = new TextSpan();
                    hiddenTextSpan.iStartLine  = astNode.Position.StartLine - 1;
                    hiddenTextSpan.iStartIndex = astNode.Position.StartPos - 1;
                    hiddenTextSpan.iEndLine    = astNode.Position.EndLine - 1;
                    hiddenTextSpan.iEndIndex   = astNode.Position.EndPos - 1;
//                    region.tsHiddenText = hiddenTextSpan;

                    sink.AddHiddenRegion(hiddenTextSpan);

                    // Add child regions
                    if (astNode is XmlElement)
                    {
                        AddHiddenRegions(sink, ((XmlElement)astNode).Content);
                    }
                    else if (astNode is NVForeachDirective)
                    {
                        AddHiddenRegions(sink, ((NVForeachDirective)astNode).Content);
                    }
                }
            }
        }
Пример #2
0
 // hidden regions - not working?
 public void DefineRegion(TextSpan span)
 {
     Sink.AddHiddenRegion(span);
 }