Example #1
0
 ///<summary>
 /// Try to parse text as html code and return result
 ///</summary>
 ///<param name="text">Text to parse</param>
 ///<param name="item">Item to assign</param>
 ///<returns></returns>
 public bool TryParsePageText(string text, ItemType item)
 {
     var p = CreateHtmlPage();
     try
     {
         p.SetPageItem(item);
         p.ParseStream(new StringReader(text), ControlControlParsed);
         HtmlPage = p;
         return true;
     }
     catch
     {
         p.Dispose();
         return false;
     }
 }
Example #2
0
        public static ItemType CreateNewItem([NotNull]string title, [NotNull]string identifier, [NotNull]string identifierRef, [NotNull]PageType pageType)
        {
            var result = new ItemType(title, identifier, identifierRef);
            result.pageType = pageType;

            if (pageType != PageType.Chapter && pageType != PageType.ControlChapter)
            {
                result.Sequencing = SequencingManager.CreateNewSequencing(result);
            }
            else
            {
                SequencingManager.CreateNewSequencing(result);
            }

            if (pageType == PageType.Question)
            {
                Course.Answers.Organizations[Course.Organization.identifier].Items.Add(new Item(identifier));
            }

            return result;
        }
Example #3
0
        public void SettingUp()
        {             
                      
            this.chapterItem = ItemType.CreateNewItem("chapter item", "ci", null, PageType.Chapter);
            this.controlChapterItem = ItemType.CreateNewItem("controlChapter item", "cci", "ewrt", PageType.ControlChapter);
            this.theoryItem = ItemType.CreateNewItem("theory item", "ti", "dsfg", PageType.Theory);
           // this.questionItem = ItemType.CreateNewItem("question item", "qi", "rtwret", PageType.Question);
            this.summaryItem = ItemType.CreateNewItem("summary item", "si", "ywwdfg", PageType.Summary);
            this.unknownItem = ItemType.CreateNewItem("unknown item", "ui", "wettw", PageType.Unknown);

            this.items = new List<ItemType>();
            this.items.Add(chapterItem);
            this.items.Add(controlChapterItem);
            this.items.Add(theoryItem);
           // this.items.Add(questionItem);
            this.items.Add(summaryItem);
            this.items.Add(unknownItem);

            this.sequencing = new SequencingType();

            this.organization = new OrganizationType();
        }
Example #4
0
 public void SetUp()
 {
     this.pattern = new SequencingPattern();
     this.organization = new OrganizationType();
     this.chapter = ItemType.CreateNewItem("Chapter", "chapter_base", null, PageType.Chapter);
     this.controlChapter = ItemType.CreateNewItem("Control Chapter", "control chapter", null, PageType.ControlChapter);
 }
Example #5
0
        //protected FFHtmlWriter(TextWriter writer): 
        //    base(writer, string.Empty)
        //{
        //    //Indent = 0;
        //}

        public FFHtmlWriter(ItemType item)
            : base(new StreamWriter(item.PageHref, false, Encoding.UTF8) { AutoFlush = false })
        {
        }
Example #6
0
 public void SetUp()
 {
     this.item = ItemType.CreateNewItem("Test Item 1", "Test_Item_1_id", null, PageType.Chapter);
 }