/// <summary> /// 该方法返回文件中所有的Hanzi对象,返回值是一个Hanzi类型的LIST /// </summary> /// <returns></returns> public static List <Hanzi> ReadAll() { List <Hanzi> ret = new List <Hanzi>(); List <Bihua> bihuabiao = new List <Bihua>(); List <Point> pt; Hanzi zi; Bihua bi; Point po; String info = "", name = "", path = "", zitiname = ""; XmlNodeList hzlist = root.ChildNodes, bhlist = null, ptlist = null, elelist; foreach (XmlNode xn in hzlist) { bihuabiao = new List <Bihua>(); name = xn.Attributes["zi"].Value; if (name == "") { continue; } zitiname = xn.Attributes["ziti"].Value; elelist = xn.ChildNodes; foreach (XmlNode xnn in elelist) { if (xnn.Name == "bihualist") { bhlist = xnn.ChildNodes; } if (xnn.Name == "info") { info = xnn.InnerText; } if (xnn.Name == "path") { path = xnn.InnerText; } } foreach (XmlNode xnn in bhlist) { ptlist = xnn.ChildNodes; pt = new List <Point>(); foreach (XmlNode xnnn in ptlist) { po = new Point(int.Parse(xnnn.Attributes["x"].Value), int.Parse(xnnn.Attributes["y"].Value)); pt.Add(po); } bi = new Bihua(pt); bihuabiao.Add(bi); } zi = new Hanzi(name, zitiname, bihuabiao, info, path); ret.Add(zi); } return(ret); }
/// <summary> /// 该方法是返回一个特定的Hanzi对象,参数2个,分别是指定返回的汉字名与字体 /// </summary> /// <param name="zi"></param> /// <param name="ziti"></param> /// <returns></returns> public static Hanzi Read(String zi, String ziti) { Hanzi ret = null; XmlNodeList hzlist = root.ChildNodes; List <Bihua> bihuabiao = new List <Bihua>(); List <Point> pt; Bihua bi; Point po; String info = "", name = "", path = "", zitiname = ""; XmlNodeList bhlist = null, ptlist = null, elelist; foreach (XmlNode xn in hzlist) { if (xn.Attributes["zi"].Value == zi && xn.Attributes["ziti"].Value == ziti) { name = xn.Attributes["zi"].Value; zitiname = xn.Attributes["ziti"].Value; elelist = xn.ChildNodes; foreach (XmlNode xnn in elelist) { if (xnn.Name == "bihualist") { bhlist = xnn.ChildNodes; } if (xnn.Name == "info") { info = xnn.InnerText; } if (xnn.Name == "path") { path = xnn.InnerText; } } foreach (XmlNode xnn in bhlist) { ptlist = xnn.ChildNodes; pt = new List <Point>(); foreach (XmlNode xnnn in ptlist) { po = new Point(int.Parse(xnnn.Attributes["x"].Value), int.Parse(xnnn.Attributes["y"].Value)); pt.Add(po); } bi = new Bihua(pt); bihuabiao.Add(bi); } ret = new Hanzi(name, zitiname, bihuabiao, info, path); break; } } return(ret); }
public void NextLevel() { nowLevel++; Random ra = new Random(); nowZi = hzlist.ElementAt(ra.Next(hzlist.Count)); nowMaxTime = ( maxTime - nowLevel >= 5 ? maxTime-nowLevel : 5 ); nowTime = nowMaxTime; t = new System.Timers.Timer(); t.Interval = 25; t.Elapsed += NowTimeChange; t.AutoReset = true; t.Enabled = true; }
public void NextLevel() { nowLevel++; Random ra = new Random(); nowZi = hzlist.ElementAt(ra.Next(hzlist.Count)); nowMaxTime = (maxTime - nowLevel >= 5 ? maxTime - nowLevel : 5); nowTime = nowMaxTime; t = new System.Timers.Timer(); t.Interval = 25; t.Elapsed += NowTimeChange; t.AutoReset = true; t.Enabled = true; }
public learn() { InitializeComponent(); Atimer.Tick += Atimer_Tick; Atimer.Interval = 25; Ale = this; Ahanzi = HanziIO.Read(Ahanzilist[i].Zi); this.hanziPictureBox1.Hanzi = Ahanzi; hanziPictureBox1.CorrectDrew += new BihuaHandler(OnCorrectDrew); hanziPictureBox1.WrongDrew += new BihuaHandler(OnWrongDrew); hanziPictureBox1.Completed += new BihuaHandler(OnCompleted); this.paraphrase.Text = Ahanzi.Info; this.infoLabel.Text = "已成功载入汉字 " + "'" + Ahanzi.Zi + "'"; }
/// <summary> /// 该方法是返回一个特定的Hanzi对象,参数2个,分别是指定返回的汉字名与字体 /// </summary> /// <param name="zi"></param> /// <param name="ziti"></param> /// <returns></returns> public static Hanzi Read(String zi, String ziti) { Hanzi ret = null; XmlNodeList hzlist = root.ChildNodes; List<Bihua> bihuabiao = new List<Bihua>(); List<Point> pt; Bihua bi; Point po; String info = "", name = "", path = "", zitiname = ""; XmlNodeList bhlist = null, ptlist = null, elelist; foreach (XmlNode xn in hzlist) { if (xn.Attributes["zi"].Value == zi && xn.Attributes["ziti"].Value == ziti) { name = xn.Attributes["zi"].Value; zitiname = xn.Attributes["ziti"].Value; elelist = xn.ChildNodes; foreach (XmlNode xnn in elelist) { if (xnn.Name == "bihualist") bhlist = xnn.ChildNodes; if (xnn.Name == "info") info = xnn.InnerText; if (xnn.Name == "path") path = xnn.InnerText; } foreach (XmlNode xnn in bhlist) { ptlist = xnn.ChildNodes; pt = new List<Point>(); foreach (XmlNode xnnn in ptlist) { po = new Point(int.Parse(xnnn.Attributes["x"].Value), int.Parse(xnnn.Attributes["y"].Value)); pt.Add(po); } bi = new Bihua(pt); bihuabiao.Add(bi); } ret = new Hanzi(name, zitiname, bihuabiao, info, path); break; } } return ret; }
public HanziPictureBox(Hanzi hanzi) { Hanzi = hanzi; }
public void Reset() { nowLevel = 0; nowTime = 0; nowZi = null; }
/// <summary> /// 该方法返回文件中所有的Hanzi对象,返回值是一个Hanzi类型的LIST /// </summary> /// <returns></returns> public static List<Hanzi> ReadAll() { List<Hanzi> ret = new List<Hanzi>() ; List<Bihua> bihuabiao = new List<Bihua>(); List<Point> pt; Hanzi zi; Bihua bi; Point po; String info = "", name = "", path = "", zitiname = ""; XmlNodeList hzlist = root.ChildNodes, bhlist = null, ptlist = null, elelist; foreach (XmlNode xn in hzlist) { bihuabiao = new List<Bihua>(); name = xn.Attributes["zi"].Value; if (name == "") continue; zitiname = xn.Attributes["ziti"].Value; elelist = xn.ChildNodes; foreach (XmlNode xnn in elelist) { if (xnn.Name == "bihualist") bhlist = xnn.ChildNodes; if (xnn.Name == "info") info = xnn.InnerText; if (xnn.Name == "path") path = xnn.InnerText; } foreach (XmlNode xnn in bhlist) { ptlist = xnn.ChildNodes; pt = new List<Point>(); foreach (XmlNode xnnn in ptlist) { po = new Point(int.Parse(xnnn.Attributes["x"].Value), int.Parse(xnnn.Attributes["y"].Value)); pt.Add(po); } bi = new Bihua(pt); bihuabiao.Add(bi); } zi = new Hanzi(name, zitiname, bihuabiao, info, path); ret.Add(zi); } return ret; }
private void prev_Click(object sender, EventArgs e) { Sound.PlaySE("se_buttonclick"); try { if (i - 1 < 0) throw new UserException("已返回字表顶端!"); Ahanzi = HanziIO.Read(Ahanzilist[--i].Zi); this.hanziPictureBox1.Hanzi = Ahanzi; this.paraphrase.Text = Ahanzi.Info; this.infoLabel.Text = "已成功载入汉字 " + "'" + Ahanzi.Zi + "'"; } catch (UserException A) { wrong Awrong = new wrong(A.Message); Awrong.Shown += BlockWindow; Awrong.FormClosed += UnblockWindow; Awrong.OnShow(); } }