static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); FrmLogin f1 = new FrmLogin(); Application.Run(f1); if (f1.Tag.ToString() == "验证成功") { FrmStudent f2 = new FrmStudent(); Application.Run(f2); } else { Application.Exit(); } }
// string path = AppDomain.CurrentDomain.BaseDirectory + @"\PathConfig.xml"; //读取PahConfig.xml的路径 /// <summary> /// 保存 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnSave_Click(object sender, EventArgs e) { string address = txtPath.Text.Trim(); //获取路径 string serviceName = txtServiceName.Text.Trim(); //获取面单打印机的名字 string format = txtFormat.Text.Trim(); //打印格式 string shopSource = this.cmbShopSource.SelectedItem.ToString(); //货的来源 string printName = this.txtPrintName.Text.Trim();//清单打印机的名字 XmlDocument doc = new XmlDocument(); doc.Load("PathConfig.xml"); //获取根节点 XmlNode xn = doc.SelectSingleNode("Config"); //创建货的来源的节点 XmlNode xn4 = doc.CreateElement("ShopSource"); //创建打印机的名字的节点 XmlNode xn6= doc.CreateElement("PrintName"); //获取路径 XmlNode node = doc.SelectSingleNode("Config/Path"); //获取服务器名字 XmlNode node2 = doc.SelectSingleNode("Config/ServiceName"); //获取打印的格式 XmlNode node3 = doc.SelectSingleNode("Config/Format"); //把货的来源节点加进来 xn.AppendChild(xn4); //把打印机的名字节点加进来 xn.AppendChild(xn6); //获取货的来源 XmlNode xn5 = doc.SelectSingleNode("Config/ShopSource"); //获取打印机名字 XmlNode xn7 = doc.SelectSingleNode("Config/PrintName"); xn5.InnerText = this.cmbShopSource.SelectedItem.ToString(); xn7.InnerText = this.txtPrintName.Text.Trim(); node.InnerText = address; node2.InnerText = serviceName; node3.InnerText = format; xn5.InnerText = shopSource; xn7.InnerText = printName; doc.Save("PathConfig.xml"); FrmLogin fl = new FrmLogin(); fl.Show(); this.Hide(); }
public FrmRegist(FrmLogin FL) { InitializeComponent(); fl = FL; }
private void treeView1_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e) { if (e.Node.Text.Trim() == "图书添加") { FrmTianJia frmTianJia = new FrmTianJia(); frmTianJia.ShowDialog(); frmTianJia.Dispose(); } else if (e.Node.Text.Trim() == "图书修改") { FrmXiuGai frmXiuGai = new FrmXiuGai(); frmXiuGai.ShowDialog(); frmXiuGai.Dispose(); } else if (e.Node.Text.Trim() == "图书删除") { FrmShanChu frmShanChu = new FrmShanChu(); frmShanChu.ShowDialog(); frmShanChu.Dispose(); } else if (e.Node.Text.Trim() == "图书查询") { BookManagermentFrom from = new BookManagermentFrom(); from.ShowDialog(); from.Dispose(); } else if (e.Node.Text.Trim() == "用户借书") { FrmBooksBorrow frmBooksBorrow = new FrmBooksBorrow(); frmBooksBorrow.ShowDialog(); frmBooksBorrow.Dispose(); } else if (e.Node.Text.Trim() == "用户还书") { FrmBooksReturn frmBookReturn = new FrmBooksReturn(); frmBookReturn.ShowDialog(); frmBookReturn.Dispose(); } else if (e.Node.Text.Trim() == "重新登录") { DialogResult dr = MessageBox.Show("是否注销用户", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (dr == DialogResult.Yes) { FrmLogin frmLogin = new FrmLogin(); frmLogin.Show(); this.Hide(); } else { } } else if (e.Node.Text.Trim() == "用户管理") { FrmYongHu frmYongHu = new FrmYongHu(); frmYongHu.ShowDialog(); frmYongHu.Dispose(); } else if (e.Node.Text.Trim() == "退出系统") { Application.Exit(); //退出系统 } else if (e.Node.Text.Trim() == "计算器") { System.Diagnostics.Process.Start("calc.exe"); } else if (e.Node.Text.Trim() == "记事本") { System.Diagnostics.Process.Start("notepad.exe"); } else if (e.Node.Text.Trim() == "帮助") { MessageBox.Show("欢迎使用该图书管理!!!"); } }
/// <summary> /// 取消 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnCancel_Click(object sender, EventArgs e) { FrmLogin fl = new FrmLogin(); fl.Show(); this.Hide(); }