private void KeyConnect_Click(object sender, EventArgs e) { Access ac = new Access(); if (File.Exists(Sequence.filename)) { wk = Sequence.LoadFromXmlFormat(); logText.AppendText("上次运行参数导入完毕!"); // LWMaxID = wk.WordID+ac.GetWCount(wk.KLWord)-1; } else { //wk.KLWord = Convert.ToInt32(cmBLWord.SelectedItem.ToString()); // wk.Tgther = Convert.ToInt32(cmBTgther.SelectedItem.ToString()); wk.order = cmBOrder.SelectedIndex; //wk.WordID = ac.GetFirstID(wk.KLWord); // LWMaxID =wk.WordID+ ac.GetWCount(wk.KLWord)-1; //wk.WordID_2 = wk.WordID + 1; wk.waitime = Convert.ToInt32(cmBInterval.Text.Trim()); } MSSQL ms = new MSSQL(); DataTable da = ms.ReadData("select Param,ClassID from SP_WenKu"); for (int i = 0; i < da.Rows.Count; i++) { HT.Add(da.Rows[i][0], da.Rows[i][1]); } KeyConnect.Enabled = false; logText.AppendText("参数构建完毕!"); keyconnected = true; }
static public void SaveAsXmlFormat(WKInfo wk) { XmlSerializer xmlFormat = new XmlSerializer(typeof(WKInfo)); using (Stream fStream = new FileStream(filename, FileMode.Create, FileAccess.Write, FileShare.None)) { xmlFormat.Serialize(fStream, wk); } }