private void button1_Click(object sender, RoutedEventArgs e) { InputWord.Text = ""; CodeArea.Text = ""; ParceCode.NavigateToString("<!DOCTYPE html ><html><meta http-equiv='Content-Type' content='text/html;charset=UTF-8'><head></head><body></body></html>"); ErrorMsg.Text = ""; }
private void HighLightCode(List <string> Code, int Line) { var Alpha = string.Empty; var Betha = string.Empty; var Arrow = string.Empty; var Dummy = string.Empty; Dummy = "<!DOCTYPE html ><html><meta http-equiv='Content-Type' content='text/html;charset=UTF-8'><head></head><body><table width=146 cellspacing=0>"; for (int i = 0; i < Code.Count; ++i) { var Rule = Code[i]; var sk = ("->").ToCharArray(); var pos = Rule.IndexOfAny(sk); if (pos < 0) { pos = Rule.IndexOf("=>"); } if (0 <= pos) { try { Alpha = Rule.Substring(0, pos); } catch (System.Exception) { Alpha = string.Empty; } try { Arrow = Rule.Substring(pos, 2); } catch (System.Exception) { Alpha = string.Empty; } if (Arrow == "->") { Arrow = "→"; } else { Arrow = "↦"; } try { Betha = Rule.Substring(pos + 2, Rule.Length - pos - 2); } catch (System.Exception) { Betha = string.Empty; } } Dummy += "<tr valign=top"; if (i == Line) { Dummy += " bgcolor=#e0f0e0"; } Dummy += "><td align=right width=25>" + (i + 1) + ". </td><td align=right>" + Alpha + "</td><td align=center style=\"font-face:times new roman,serif;\">" + Arrow + "</td><td align=left>" + Betha + " </td></tr>"; } Dummy += "</table></body></html>"; ParceCode.NavigateToString(Dummy); }