private void PrintPICC2_Load(object sender, EventArgs e) { throw new Exception("Unknown Error!"); DateTime dt = new DateTime(); dt = System.DateTime.Now; dtp_Start.Value = dt; dtp_Date.Value = dt; dtp_End.Value = dt.AddDays(6); pi = GetConfig(); tb_Signature.Text = pi.Signature; cb_Method.Text = pi.Conflict; 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.button1.Visible = false; //try { conn.Open(); } //catch //{ // MessageBox.Show("数据库连接失败!"); // Application.Exit(); //} }
private picc2 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(); picc2 ret = new picc2(); NewPara np = new NewPara(temp); ret.Signature = np.FindTextByPath("//eg/PrintPICC2/Signature"); ret.Conflict = np.FindTextByPath("//eg/PrintPICC2/Conflict"); ret.OffsetX = int.Parse(np.FindTextByPath("//eg/PrintPICC2/OffsetX")); ret.OffsetY = int.Parse(np.FindTextByPath("//eg/PrintPICC2/OffsetY")); ret.SaveNo = np.FindTextByPath("//eg/PrintPICC2/SaveNo"); return(ret); }