private string getScore(Colloc.Result res) { int score; if (rbLogLike.Checked) { score = (int)res.LL; } else { score = (int)res.ChSqCorr; } string fmt = "{0:#,#}"; return(string.Format(fmt, score)); }
private void renderHtml() { StringBuilder sb = new StringBuilder(); if (rbLogLike.Checked) { colloc.ResArr.Sort((x, y) => y.LL.CompareTo(x.LL)); } else { colloc.ResArr.Sort((x, y) => y.ChSqCorr.CompareTo(x.ChSqCorr)); } for (int i = 0; i < colloc.ResArr.Count && i < 100; ++i) { Colloc.Result res = colloc.ResArr[i]; sb.Append("<tr><td valign='top' class='score'>"); sb.Append(getScore(res)); sb.Append("</td><td valign='top' class='word'>"); sb.Append(res.Word); sb.Append("<br/>"); string py, trg; getDict(res.Word, out py, out trg); sb.Append(esc(py)); sb.Append("</td><td valign='top' class='dict'>"); sb.Append(trg); sb.Append("</td></tr>\r\n"); } string html = htmlSkeleton; html = html.Replace("{results}", sb.ToString()); wb.Navigate("about:blank"); if (wb.Document != null) { wb.Document.Write(string.Empty); } wb.DocumentText = html; }