//文件菜单按钮事件 void menu_Click(object sender, EventArgs e) { MysqlHelper.UpdatePage(filename, page); ToolStripMenuItem menu = (ToolStripMenuItem)sender; string str = menu.Text.Substring(menu.Text.LastIndexOf(@"\", StringComparison.Ordinal) + 1); str = str.Substring(0, str.IndexOf('.')); DataSet fileread = MysqlHelper.FileRead(str); if (fileread != null) { DataRow row = fileread.Tables[0].Rows[0]; string path = row["path"].ToString(); int.TryParse(row["page"].ToString(), out page); filename = menu.Text; if (Init()) { article.Clear(); } //page = fr.LoadLastRead(filehistory); article = fr.ReadTxt(path); textBox1.Text = article[page]; toolStripTextBox1.Text = page + 1 + "/" + article.Count; SetCatalog(fr.GetCatalog(path)); //fr.SaveLastRead(filehistory, page); } }
//退出按钮 private void 退出ToolStripMenuItem_Click(object sender, EventArgs e) { MysqlHelper.UpdatePage(filename, page); MysqlHelper.MysqlClose(); Close(); }