private void outCut(string fileName) { //this.gridList.EndEdit(); CutMothedOutLib outLib = new CutMothedOutLib(); outLib.CutMotheds = this._CutMotheds; Serialize.Write <CutMothedOutLib>(outLib, fileName); }
/// <summary> /// /// </summary> /// <param name="fileName"></param> private void outCut(string fileName) { this.gridListCut.EndEdit(); getCutMotheds(this._cutMotheds); CutMothedOutLib outLib = new CutMothedOutLib(); outLib.CutMotheds = outCutMothedList; Serialize.Write <CutMothedOutLib>(outLib, fileName); }
/// <summary> /// /// </summary> /// <param name="fileName"></param> public void initAllCutMothed(string fileName) { if (File.Exists(fileName)) { try { CutMothedOutLib outCutMothedLib = Serialize.Read <CutMothedOutLib>(fileName); SetRow(); if (this.gridListCut.Rows.Count < outCutMothedLib.CutMotheds.Count) { this.gridListCut.Rows.Add(outCutMothedLib.CutMotheds.Count - this.gridListCut.Rows.Count); } for (int i = 0; i < outCutMothedLib.CutMotheds.Count; i++) { if (outCutMothedLib.CutMotheds[i].ICP != (int)enumCutMothedICPECP.ICPMin) { this.gridListCut.Rows[i].Cells["ICP"].Value = outCutMothedLib.CutMotheds[i].ICP; } else { this.gridListCut.Rows[i].Cells["ICP"].Value = null; } if (outCutMothedLib.CutMotheds[i].ECP == (int)enumCutMothedICPECP.ECPMax) { this.gridListCut.Rows[i].Cells["ECP"].Value = null; } else { this.gridListCut.Rows[i].Cells["ECP"].Value = outCutMothedLib.CutMotheds[i].ECP; } this.gridListCut.Rows[i].Cells["Name"].Value = outCutMothedLib.CutMotheds[i].Name; this.gridListCut.Rows[i].Cells["CutType"].Value = outCutMothedLib.CutMotheds[i].CutType; } } catch (Exception ex) { MessageBox.Show("文件内容有误!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Error); Log.Error("" + ex.ToString()); } } }
/// <summary> /// 读取切割方案 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void toolStripButton3_Click(object sender, EventArgs e) { OpenFileDialog saveFileDialog = new OpenFileDialog(); saveFileDialog.Filter = "切割方案文件 (*.cut)|*.cut"; saveFileDialog.RestoreDirectory = true; if (saveFileDialog.ShowDialog() == DialogResult.OK) { this._outLib = Serialize.Read <CutMothedOutLib>(saveFileDialog.FileName); SetRow(); if (this.gridListCut.Rows.Count < this._outLib.CutMotheds.Count) { this.gridListCut.Rows.Add(this._outLib.CutMotheds.Count - this.gridListCut.Rows.Count); } for (int i = 0; i < this._outLib.CutMotheds.Count; i++) { if (this._outLib.CutMotheds[i].ICP != -2000) { this.gridListCut.Rows[i].Cells["ICP"].Value = this._outLib.CutMotheds[i].ICP; this.gridListCut.Rows[i].Cells["ECP"].Value = this._outLib.CutMotheds[i].ECP; this.gridListCut.Rows[i].Cells["Name"].Value = this._outLib.CutMotheds[i].Name; this.gridListCut.Rows[i].Cells["CutType"].Value = this._outLib.CutMotheds[i].CutType; } else { this.gridListCut.Rows[i].Cells["ICP"].Value = null; this.gridListCut.Rows[i].Cells["ECP"].Value = this._outLib.CutMotheds[i].ECP; this.gridListCut.Rows[i].Cells["Name"].Value = this._outLib.CutMotheds[i].Name; this.gridListCut.Rows[i].Cells["CutType"].Value = this._outLib.CutMotheds[i].CutType; } } } else { return; } }