private void buttonSave_Click(object sender, EventArgs e) { if (string.IsNullOrWhiteSpace(this.textBoxId.Text)) { MessageBox.Show("아이디는 필수로 입력해야 합니다."); return; } this.buttonSave.Enabled = false; if (this.action != Info.Action.MODIFY) { this.pRecipe = new Info.ProcessProgram(this.textBoxId.Text, Info.PPIDType.TYPE_1); } this.pRecipe.processCommands.Clear(); Info.ProcessCommand processCommand = new Info.ProcessCommand(); for (int i = 0; i < this.dataGridView1.Rows.Count - 1; i++) { Info.Parameter parameter = new Info.Parameter((string)this.dataGridView1[0, i].Value, (string)this.dataGridView1[1, i].Value); processCommand.CCODE.Add(parameter); } this.pRecipe.processCommands.Add(processCommand); this.DialogResult = System.Windows.Forms.DialogResult.OK; this.Close(); }
private void buttonOpen_Click(object sender, EventArgs e) { try { DialogResult res = this.openFileDialog1.ShowDialog(); if (res == System.Windows.Forms.DialogResult.Cancel) { return; } string fileName = this.openFileDialog1.SafeFileName; System.Runtime.Serialization.Formatters.Binary.BinaryFormatter bf = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter(); System.IO.FileStream fs = System.IO.File.Open(this.savePath + "\\" + fileName, System.IO.FileMode.Open); Info.ProcessProgram PP = (Info.ProcessProgram)bf.Deserialize(fs); fs.Close(); this.textBoxID.Text = PP.ID; this.comboBoxType.SelectedIndex = (int)PP.TYPE; this.dataGridViewBody.Rows.Clear(); foreach (Info.Parameter p in PP.processCommands[0].CCODE) { this.dataGridViewBody.Rows.Add(p.P_PARM_NAME, p.P_PARM); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
void subSave(Info.ProcessProgram dProcessProgram) { this.ppidHash.Add(dProcessProgram.ID, dProcessProgram); System.Runtime.Serialization.Formatters.Binary.BinaryFormatter dBinaryFormatter = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter(); System.IO.FileStream dFileStream = System.IO.File.Create(this.savePath + "\\" + dProcessProgram.ID + ".ppid"); dBinaryFormatter.Serialize(dFileStream, dProcessProgram); dFileStream.Close(); }
void subModifyPPID(Info.ProcessProgram ppid) { if (ppid.TYPE == Info.PPIDType.TYPE_1) { recipeStateChanged(ppid, Info.Action.MODIFY); } else { } }
/// <summary> /// 바이너리 파일들을 읽어 this.ppidHash를 초기화한다. /// </summary> void subLoadingFiles() { string[] dFiles = System.IO.Directory.GetFiles(this.savePath); // GetFiles의 리턴값은 전체 경로를 포함한다 System.Runtime.Serialization.Formatters.Binary.BinaryFormatter dBinaryFormatter = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter(); foreach (string item in dFiles) { System.IO.FileStream dFileStream = System.IO.File.Open(item, System.IO.FileMode.Open); Info.ProcessProgram dProcessProgram = (Info.ProcessProgram)dBinaryFormatter.Deserialize(dFileStream); dFileStream.Close(); this.ppidHash.Add(dProcessProgram.ID, dProcessProgram); } }
private void listBoxType1_SelectedIndexChanged(object sender, EventArgs e) { if (this.listBoxType1.SelectedIndex == -1) { return; } Info.ProcessProgram dProcessProgram = this.mPpidType1[this.listBoxType1.SelectedIndex]; this.dataGridViewType1.Rows.Clear(); foreach (Info.Parameter item in dProcessProgram.processCommands[0].CCODE) { this.dataGridViewType1.Rows.Add(item.P_PARM_NAME, item.P_PARM); } }
private void buttonSave_Click(object sender, EventArgs e) { if (string.IsNullOrWhiteSpace(this.textBoxId.Text)) { MessageBox.Show("HOST PPID 입력은 필수입니다."); return; } this.pRecipe = new Info.ProcessProgram(this.textBoxId.Text, Info.PPIDType.TYPE_2); Info.ProcessCommand dProcessCommand = new Info.ProcessCommand(); //dProcessCommand.CCODE.Add(new Info.Parameter("SubPPID", (string)this.comboBoxEqpPpid.SelectedValue)); dProcessCommand.CCODE.Add(new Info.Parameter("SubPPID", (string)this.comboBoxEqpPpid.SelectedItem)); this.pRecipe.processCommands.Add(dProcessCommand); this.DialogResult = System.Windows.Forms.DialogResult.OK; this.Close(); }
private void buttonDefaultLoad_Click(object sender, EventArgs e) { if (!System.IO.File.Exists(mDefaultFilePath)) { System.Windows.Forms.MessageBox.Show("파일이 없습니다. 새로 저장해 주세요."); return; } this.dataGridView1.Rows.Clear(); System.IO.Stream dStream = System.IO.File.Open(mDefaultFilePath, System.IO.FileMode.Open, System.IO.FileAccess.Read); Info.ProcessProgram dRecipe = (Info.ProcessProgram)mBinaryFormatter.Deserialize(dStream); dStream.Close(); foreach (Info.Parameter item in dRecipe.processCommands[0].CCODE) { this.dataGridView1.Rows.Add(item.P_PARM_NAME, item.P_PARM); } System.Windows.Forms.MessageBox.Show("기본 서식을 불러왔습니다."); }
private void buttonDefaultSave_Click(object sender, EventArgs e) { Info.ProcessProgram dRecipe = new Info.ProcessProgram("default", Info.PPIDType.TYPE_1); Info.ProcessCommand processCommand = new Info.ProcessCommand(); for (int i = 0; i < this.dataGridView1.Rows.Count - 1; i++) { Info.Parameter parameter = new Info.Parameter((string)this.dataGridView1[0, i].Value, (string)this.dataGridView1[1, i].Value); processCommand.CCODE.Add(parameter); } dRecipe.processCommands.Add(processCommand); System.IO.Stream dStream = System.IO.File.Create(mDefaultFilePath); mBinaryFormatter.Serialize(dStream, dRecipe); dStream.Close(); System.Windows.Forms.MessageBox.Show("저장되었습니다."); }
private void buttonSave_Click(object sender, EventArgs e) { try { Info.ProcessProgram PP = new Info.ProcessProgram(this.textBoxID.Text, (Info.PPIDType) this.comboBoxType.SelectedIndex); Info.ProcessCommand PC = new Info.ProcessCommand(); for (int i = 0; i < this.dataGridViewBody.RowCount - 1; i++) { Info.Parameter P = new Info.Parameter(this.dataGridViewBody.Rows[i].Cells[0].Value.ToString(), this.dataGridViewBody.Rows[i].Cells[1].Value.ToString()); PC.CCODE.Add(P); } PP.processCommands.Add(PC); this.subSave(PP); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
void subCreatePPID(Info.ProcessProgram ppid) { recipeStateChanged(ppid, Info.Action.CREATE); }
private void buttonDelete_Click(object sender, EventArgs e) { System.IO.Stream dFile = null; Info.ProcessProgram dRecipe = null; //Info.ProcessProgram dRecipeOld = null; switch (this.tabControl1.SelectedIndex) { case 0: return; break; case 1: int dintIndex = this.listBoxType1.SelectedIndex; if (dintIndex == -1) { return; } dRecipe = this.mPpidType1[dintIndex]; DialogResult res = System.Windows.Forms.MessageBox.Show(string.Format("EQP PPID : {0} 을(를) 정말로 삭제 하시겠습니까?", dRecipe.ID), "경고", MessageBoxButtons.OKCancel); if (res != System.Windows.Forms.DialogResult.OK) { return; } System.IO.File.Delete(this.mType1Folder + "\\" + dRecipe.ID + this.mSuffix); this.listBoxType1.Items.RemoveAt(dintIndex); this.mPpidType1.RemoveAt(dintIndex); if (dintIndex - 1 >= 0) { this.listBoxType1.SelectedIndex = dintIndex - 1; } break; case 2: int dintIndex2 = this.listBoxType2.SelectedIndex; if (dintIndex2 == -1) { return; } dRecipe = this.mPpidType2[dintIndex2]; DialogResult res2 = System.Windows.Forms.MessageBox.Show(string.Format("HOST PPID : {0} 을(를) 정말로 삭제 하시겠습니까?", dRecipe.ID), "경고", MessageBoxButtons.OKCancel); if (res2 != System.Windows.Forms.DialogResult.OK) { return; } System.IO.File.Delete(this.mType2Folder + "\\" + dRecipe.ID + this.mSuffix); this.listBoxType2.Items.RemoveAt(dintIndex2); this.mPpidType2.RemoveAt(dintIndex2); if (dintIndex2 - 1 >= 0) { this.listBoxType2.SelectedIndex = dintIndex2 - 1; } break; } if (dRecipe.TYPE == Info.PPIDType.TYPE_1) { //todo 매핑 정보도 지워야한다. } else if (dRecipe.TYPE == Info.PPIDType.TYPE_2) { //todo 링크를 끊어야함 } this.subDeletePPID(dRecipe); }
private void buttonModify_Click(object sender, EventArgs e) { System.IO.Stream dFile = null; Info.ProcessProgram dRecipe = null; Info.ProcessProgram dRecipeOld = null; switch (this.tabControl1.SelectedIndex) { case 0: return; break; case 1: if (this.listBoxType1.SelectedIndex == -1) { return; } dRecipeOld = this.mPpidType1[this.listBoxType1.SelectedIndex]; Forms.PpidType1 type1Ppid = new PpidType1(Info.Action.MODIFY); type1Ppid.pRecipe = dRecipeOld; DialogResult res = type1Ppid.ShowDialog(); if (res != System.Windows.Forms.DialogResult.OK) { return; } dRecipe = type1Ppid.pRecipe; dFile = System.IO.File.Create(this.mType1Folder + "\\" + type1Ppid.pRecipe.ID + this.mSuffix); break; case 2: List <string> recipes = new List <string>(); foreach (Info.ProcessProgram item in mPpidType1) { recipes.Add(item.ID); } Forms.PpidType2 type2Ppid = new PpidType2(recipes, Info.Action.MODIFY); DialogResult res2 = type2Ppid.ShowDialog(); if (res2 != System.Windows.Forms.DialogResult.OK) { return; } dRecipe = type2Ppid.pRecipe; dFile = System.IO.File.Create(this.mType2Folder + "\\" + type2Ppid.pRecipe.ID + this.mSuffix); break; } if (dFile == null || dRecipe == null) { if (dFile != null) { dFile.Close(); } return; } this.mBinaryFormatter.Serialize(dFile, dRecipe); dFile.Close(); if (dRecipe.TYPE == Info.PPIDType.TYPE_1) { foreach (Info.ProcessProgram item in dRecipeOld.funMappingList()) { dRecipe.subMapping(item); } this.mPpidType1.Remove(dRecipeOld); this.listBoxType1.Items.Remove(dRecipeOld.ID); this.mPpidType1.Add(dRecipe); this.listBoxType1.Items.Add(dRecipe.ID); } else if (dRecipe.TYPE == Info.PPIDType.TYPE_2) { this.mPpidType2.Add(dRecipe); foreach (Info.ProcessProgram item in this.mPpidType1) { if (item.ID == dRecipe.processCommands[0].CCODE[0].P_PARM) { item.subMapping(dRecipe); } } } //this.subCreatePPID(dRecipe); this.subModifyPPID(dRecipe); if (dRecipe.TYPE == Info.PPIDType.TYPE_1) { foreach (Info.ProcessProgram item in dRecipe.funMappingList()) { this.subModifyPPID(item); } } }
private void buttonCreate_Click(object sender, EventArgs e) { System.IO.Stream dFile = null; Info.ProcessProgram dRecipe = null; switch (this.tabControl1.SelectedIndex) { case 0: return; break; case 1: Forms.PpidType1 type1Ppid = new PpidType1(Info.Action.CREATE); DialogResult res = type1Ppid.ShowDialog(); if (res != System.Windows.Forms.DialogResult.OK) { return; } foreach (Info.ProcessProgram item in this.mPpidType1) { if (item.ID == type1Ppid.pRecipe.ID) { System.Windows.Forms.MessageBox.Show("아이디는 유일해야 합니다"); return; } } dRecipe = type1Ppid.pRecipe; dFile = System.IO.File.Create(this.mType1Folder + "\\" + type1Ppid.pRecipe.ID + this.mSuffix); break; case 2: List <string> recipes = new List <string>(); foreach (Info.ProcessProgram item in mPpidType1) { recipes.Add(item.ID); } Forms.PpidType2 type2Ppid = new PpidType2(recipes, Info.Action.CREATE); DialogResult res2 = type2Ppid.ShowDialog(); if (res2 != System.Windows.Forms.DialogResult.OK) { return; } foreach (Info.ProcessProgram item in this.mPpidType2) { if (item.ID == type2Ppid.pRecipe.ID) { System.Windows.Forms.MessageBox.Show("아이디는 유일해야 합니다"); return; } } dRecipe = type2Ppid.pRecipe; dFile = System.IO.File.Create(this.mType2Folder + "\\" + type2Ppid.pRecipe.ID + this.mSuffix); break; } if (dFile == null || dRecipe == null) { if (dFile != null) { dFile.Close(); } return; } this.mBinaryFormatter.Serialize(dFile, dRecipe); dFile.Close(); if (dRecipe.TYPE == Info.PPIDType.TYPE_1) { this.mPpidType1.Add(dRecipe); this.listBoxType1.Items.Add(dRecipe.ID); this.listBoxType1.SelectedIndex = this.listBoxType1.Items.Count - 1; } else if (dRecipe.TYPE == Info.PPIDType.TYPE_2) { this.mPpidType2.Add(dRecipe); this.listBoxType2.Items.Add(dRecipe.ID); this.listBoxType2.SelectedIndex = this.listBoxType2.Items.Count - 1; foreach (Info.ProcessProgram item in this.mPpidType1) { if (item.ID == dRecipe.processCommands[0].CCODE[0].P_PARM) { item.subMapping(dRecipe); } } } this.subCreatePPID(dRecipe); }
void subDeletePPID(Info.ProcessProgram ppid) { recipeStateChanged(ppid, Info.Action.DELETE); }
void ppidManager_recipeStateChanged(Info.ProcessProgram recipe, Info.Action action) { this.recipeStateChanged(recipe, action); }