/// <summary> /// Set the HTML /// </summary> private void InitHTML() { StringBuilder html = new StringBuilder(File.ReadAllText(FileManager.getContent("$html/Welcome.html"))); XmlProvider prov = new XmlProvider(); Core.Model.Library lib = prov.Load(ProfileController.Current.LibraryLastFile); HtmlBuilder leftpane = new HtmlBuilder(); HtmlBuilder rightpane = new HtmlBuilder(); Current = lib.GetPuzzleByID(ProfileController.Current.LibraryLastPuzzle); if (Current == null) { ProfileController.Current.LibraryLastPuzzle = lib.Puzzles[0].PuzzleID; Current = lib.Puzzles[0]; } if (Current != null) { leftpane.AddSection(null); HtmlReporter.Report(leftpane, Current.Library.Details); rightpane.AddLine("{0}/{1} '<b>{2}</b>'", Current.Order, Current.Library.Puzzles.Count, Current.Details.Name); rightpane.Add("<a href=\"app://Puzzle/{0}\">", Current.PuzzleID); rightpane.Add(Current.MasterMap, DrawingHelper.DrawPuzzle(Current.MasterMap), null); rightpane.Add("</a>"); rightpane.AddLine("<br/><i>Click to play...</i>"); } else { // Library has no puzzles } html = html.Replace("[Details]", leftpane.GetHTMLBody()); html = html.Replace("[Image]", rightpane.GetHTMLBody()); html = html.Replace("[BASEHREF]", FileManager.getContent("$html")); html = html.Replace("[USERNAME]", ProfileController.Current.UserName); htmlView.SetHTML(html.ToString()); }
public void Add(HtmlBuilder body) { if (body == null) return; htmlBody.Append(body.GetHTMLBody()); }