private void btnExport_Click(object sender, EventArgs e) { SaveFileDialog dialog = new SaveFileDialog(); dialog.Filter = ContraHelper.FilterCnc; dialog.FileName = "newFile1.cnc"; if (dialog.ShowDialog() == DialogResult.OK) { PNCHelper.SaveCnc(HoleCollection, dialog.FileName, Settings.Default.Set.OtherSet.ScriptMode); FileName = dialog.FileName.Replace(".cnc", ".pnc"); ContraHelper.ShowMessage(L.R("FormHoleEdit.DaoChuChengGong", "导出成功!")); } }
private void btnImport_Click(object sender, EventArgs e) { OpenFileDialog dialog = new OpenFileDialog(); dialog.Filter = ContraHelper.FilterCnc; if (dialog.ShowDialog() == DialogResult.OK) { this.bindingSourceHole.DataSource = PNCHelper.LoadCnc(dialog.FileName, Settings.Default.Set.OtherSet.ScriptMode); this.bindingSourceHole.ResetBindings(false); FileName = dialog.FileName.Replace(".cnc", ".pnc"); ContraHelper.ShowMessage(L.R("FormHoleEidt.DaoRuChengGong", "导入成功!")); } }
public static List <PCKStandardInfo> LoadCnc(string fileName, string scriptMode) { List <PCKStandardInfo> list = new List <PCKStandardInfo>(); var holes = PNCHelper.LoadCnc(fileName, scriptMode); foreach (var item in holes) { PCKStandardInfo pckInfo = new PCKStandardInfo(); pckInfo.AxisType = item.AxisType; pckInfo.X = item.X; pckInfo.Y = item.Y; pckInfo.W = item.W; pckInfo.B = item.C; pckInfo.C = item.C; list.Add(pckInfo); } return(list); }