///<summary> /// Gets page assigned to <see cref="item" /> ///</summary> ///<param name="item">Item which assigned to page we need to find</param> ///<returns></returns> new public static HtmlPage GetPage(ItemType item) { HtmlPage resultPage = (HtmlPage)HtmlPageBase.GetPage(item); if (resultPage != null) { } return(resultPage); }
///<summary> /// Run validation ///</summary> ///<returns></returns> public bool Validate() { _Errors = new StringBuilder(); _CurrentList = new ErrorsCollection(); foreach (var i in Course.Organization.Items) { if (i.PageType == PageType.Question) { var p = HtmlPageBase.GetPage(i); if (p == null) { using (var page = new HtmlPage { Parent = new Form() }) { page.Name = i.Title; page.SetPageItem(i); page.ParseHtmlFile(i.PageHref, (htmlPage, control) => { }); page.ReValidate(); _CurrentList.AddRange(page.Errors); } } else { p.ReValidate(); _CurrentList.AddRange(p.Errors); } foreach (var error in _CurrentList) { if (_Errors.Length > 0) { _Errors.AppendLine(); } _Errors.Append(i.GetFullPath()); if (error.Source != i) { _Errors.Append("/" + error.Source.Title); } _Errors.Append(": "); _Errors.Append(error.Message); } } foreach (string error in i.Errors) { this._Errors.AppendLine(error); } } return(_Errors.Length == 0); }