private void btnReader_Click(object sender, EventArgs e) { frmImport frm = new frmImport(); if (frm.ShowDialog() == DialogResult.OK) { dataBindingSource.DataSource = dataManager.GetDataList(); RefreshDataList(); } //try //{ // string oldstr; // string pathstr; // OpenFileDialog file = new OpenFileDialog(); // file.Filter = "授权文件(*.key)|*.key|所有文件(*.*)|*.*"; // if (file.ShowDialog() == DialogResult.OK) // { // pathstr = file.FileName; // StreamReader sr = new StreamReader(pathstr); // oldstr = sr.ReadToEnd(); // string ss = RC6Encryption.Decrypt(oldstr); // sr.Dispose(); // sr.Close(); // StreamWriter sw = new StreamWriter(pathstr, false); // sw.Write(ss); // sw.Flush(); // sw.Dispose(); // sw.Close(); // DataSet ds = new DataSet(); // ds.ReadXml(pathstr); // sw = new StreamWriter(pathstr, false); // sw.Write(oldstr); // sw.Flush(); // sw.Dispose(); // sw.Close(); // dataManager.SetInfo(ds); // dataBindingSource.DataSource = dataManager.GetDataList(); // RefreshDataList(); // MessageBox.Show("导入授权文件成功!", "信息提示"); // } //} //catch (Exception ex) { MessageBox.Show("导入授权文件失败!\n" + ex.Message, "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void toolStripButton11_Click(object sender, EventArgs e) { frmImport frm = new frmImport(); ShowChildForm(frm); }