Beispiel #1
0
        public override List <string> Show(int width)
        {
            Parse();
            List <string> formatText = new List <string>();
            List <string> textFragment;

            for (int i = 0; i < SectionContent.Count; i++)
            {
                bool check = (SectionContent[i].GetType().ToString() == "WpfApplication1.Columns");
                if (check)
                {
                    if ((i == SectionContent.Count - 1) || (SectionContent[i + 1].GetType().ToString() != "WpfApplication1.Columns"))
                    {
                        textFragment = SectionContent[i].Show(width - 7);
                        for (int j = 0; j < textFragment.Count; j++)
                        {
                            formatText.Add("    " + textFragment[j]);
                        }
                    }
                    else
                    {
                        textFragment = FormattingText.Show(SectionContent[i].Show(width / 2 - 5), SectionContent[i + 1].Show(width / 2 - 5));
                        for (int j = 0; j < textFragment.Count; j++)
                        {
                            formatText.Add("    " + textFragment[j]);
                        }
                        i++;
                    }
                }
                else
                {
                    textFragment = SectionContent[i].Show(width - 1);
                    for (int j = 0; j < textFragment.Count; j++)
                    {
                        formatText.Add(" " + textFragment[j]);
                    }
                }
            }
            formatText.Add("");
            return(formatText);
        }
        List <string> Show(int width)
        {
            Parse();
            List <string> formatText   = new List <string>();
            List <string> textFragment = new List <string>();

            for (int i = 0; i < _formatDocument.Count; i++)
            {
                bool check = (_formatDocument[i].GetType().ToString() == "WpfApplication1.Columns");
                if (check)
                {
                    if ((i == _formatDocument.Count - 1) || (_formatDocument[i + 1].GetType().ToString() != "WpfApplication1.Columns"))
                    {
                        textFragment = _formatDocument[i].Show(width - 7);
                        for (int j = 0; j < textFragment.Count; j++)
                        {
                            formatText.Add("    " + textFragment[j]);
                        }
                    }
                    else
                    {
                        textFragment = FormattingText.Show(_formatDocument[i].Show(width / 2 - 5), _formatDocument[i + 1].Show(width / 2 - 5));
                        for (int j = 0; j < textFragment.Count; j++)
                        {
                            formatText.Add("    " + textFragment[j]);
                        }
                    }
                }
                else
                {
                    textFragment = _formatDocument[i].Show(width);
                    for (int j = 0; j < textFragment.Count; j++)
                    {
                        formatText.Add(textFragment[j]);
                    }
                }
            }
            return(formatText);
        }