private void MenuItemFile_Open_Excel_Click(object sender, EventArgs e) { OpenFileDialog ofd = new OpenFileDialog(); ofd.Title = "Please select regmap excel file..."; ofd.Filter = "xlsx(*.xlsx)|*.xlsx|xls(*.xls)|*.xls|All Files(*.*)|*.*"; //ofd.RestoreDirectory = true; ofd.ReadOnlyChecked = true; if (ofd.ShowDialog() == DialogResult.OK) { DS_Excel = ImportExcel(ofd.FileName); if (DS_Excel == null) { return; } DataSet = new MDDataSet(DS_Excel); regMap = DataSet.RegMap; // Init tabs with created data tables CreateTabs(DataSet.DS_Display); } else { return; } }
private void DeserializeMethod(string path) { //创建一个文件流 IFormatter formatter = new BinaryFormatter(); Stream destream = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read); DataSet = formatter.Deserialize(destream) as MDDataSet; destream.Close(); //To DO: Add create taps on GUI with dataset }
private void MenuItemFile_Close_Click(object sender, EventArgs e) { this.tabCtrlRegView.TabPages.Clear(); this.DataSet = null; this.DS_Excel = null; }