private void PrintPICC_Load(object sender, EventArgs e) { throw new Exception("Unknown Error!"); DateTime dt = new DateTime(); dt = System.DateTime.Now; dtp1.Value = dt; dtp_Date.Value = dt; dtp2.Value = dt.AddDays(2); pi = GetConfig(); tb_Signture.Text = pi.Signature; cb_cardType.Text = pi.CardType; numericUpDown1.Value = pi.OffsetX; numericUpDown2.Value = pi.OffsetY; tb_No.Text = pi.SaveNo; retstring = ""; b_opened = true; connect_4_Command.PrintWindowOpen = true; context = this; this.ActiveControl = this.tb_eNumber; //try { conn.Open(); } //catch //{ // MessageBox.Show("数据库连接失败!"); // Application.Exit(); //} }
private picc GetConfig() { FileStream fs = new FileStream(GlobalVar.s_configfile, FileMode.Open, FileAccess.Read); StreamReader sr = new StreamReader(fs, Encoding.Default); string temp = sr.ReadToEnd(); sr.Close(); fs.Close(); picc ret = new picc(); NewPara np = new NewPara(temp); ret.CardType = np.FindTextByPath("//eg/PrintPICC/CardType"); ret.Signature = np.FindTextByPath("//eg/PrintPICC/Signature"); ret.OffsetX = int.Parse(np.FindTextByPath("//eg/PrintPICC/OffsetX")); ret.OffsetY = int.Parse(np.FindTextByPath("//eg/PrintPICC/OffsetY")); ret.SaveNo = np.FindTextByPath("//eg/PrintPICC/SaveNo"); return(ret); }