private void Form1_FormClosing(object sender, FormClosingEventArgs e) { if (txtWorkNo.Text.Length > 0) { string cachePath = System.IO.Directory.GetCurrentDirectory() + @"\cache"; ExcelAdapter.SaveGirdersAsNewFile(cachePath, Entity); } }
private void btSaveAs_Click(object sender, EventArgs e) { SaveFileDialog dialog = new SaveFileDialog { Title = "请选择保存目录", Filter = "Excel工作簿(*xls*)|*.xls*", }; if (dialog.ShowDialog() == DialogResult.OK) { string file = dialog.FileName;//返回文件的完整路径 ExcelAdapter.SaveGirdersAsNewFile(file, Entity); } }
private void btImport_Click(object sender, EventArgs e) { OpenFileDialog dialog = new OpenFileDialog { Title = "请选择项目文件", Filter = "Excel工作簿(*xls*)|*.xls*" }; if (dialog.ShowDialog() == DialogResult.OK) { string file = dialog.FileName;//返回文件的完整路径 ExcelAdapter.GetGirdersFromExcel(file, ref Entity); ShowBulkheads(Entity.Type); } }
private void Form1_Load(object sender, EventArgs e) { Entity = new Girders(); //初始化加载 //ShowBeads(0, 0, Robot.Left); ShowBulkheads("A"); ShowBeads(); ParasBind(); //todo:状态展示 picLeftState.Image = Properties.Resources.Image2; picRightState.Image = Properties.Resources.Image2; picPLCState.Image = Properties.Resources.Image2; monitor.StartMonitor(); monitor.subscription.DataChanged += new Opc.Da.DataChangedEventHandler(this.OnMonitorChange); monitor.Readall(ref PLCPara); DialogResult res = MessageBox.Show("是否打开上一次的项目", "提示", MessageBoxButtons.YesNo); if (res == DialogResult.Yes) { ExcelAdapter.GetGirdersFromExcel(System.IO.Directory.GetCurrentDirectory() + @"\cache.xlsm", ref Entity); } }