public BatchCommandList BatchOpen(int BatchNum, BatchCommandList BatchList, string deviceName) { List<string> scriptList = new List<string>(); CommonOpenSave.ScriptOpen(ref scriptList); BatchList.myBatchList[BatchNum - 1].Commands.Clear(); bool flag = false; for (int i = 0; i < scriptList.Count; i++) { string local1 = scriptList[i]; if (!flag) { if (scriptList[i].StartsWith("#BatchName")) { BatchList.myBatchList[BatchNum - 1].Name = scriptList[i].Replace("#BatchName ", ""); } if (scriptList[i].StartsWith("#BATCHNAME")) { BatchList.myBatchList[BatchNum - 1].Name = scriptList[i].Replace("#BATCHNAME ", ""); } flag = true; } else { BatchList.myBatchList[BatchNum - 1].Commands.Add(scriptList[i]); } } return BatchList; }
public void BatchSave(int BatchNum, BatchCommandList BatchList, string deviceName) { List<string> scriptList = new List<string> { "#BatchName " + BatchList.myBatchList[BatchNum - 1].Name }; foreach (string str in BatchList.myBatchList[BatchNum - 1].Commands) { scriptList.Add(str); } CommonOpenSave.ScriptSave(scriptList, "Batch" + BatchNum.ToString() + "_" + deviceName.Replace("/", "_") + "_" + BatchList.myBatchList[BatchNum - 1].Name.Replace("/", "_")); }
private void cbbMasterDB_SelectedIndexChanged(object sender, EventArgs e) { try { RegisterDGVACC = _myDev; if (dgvRegisterList.Rows.Count > 0) { dgvRegisterList.Rows[0].Selected = true; dgvRegisterList_SelectionChanged(null, null); } bool flag1 = _myDev.Notes == ""; myFifoReadWrite = new FifoReadWrite(_myDev.TxPufferSize, _myDev.RxPufferSize); FifoViewACC = myFifoReadWrite; myBatchCommandList = new BatchCommandList(); BatchViewACC = myBatchCommandList; myFormStatus = FormViewACC; } catch (Exception exception) { MessageBox.Show("Error at Database Selection!\n" + exception.Message); } }
private void btnSaveBatch_Click(object sender, EventArgs e) { try { myBatchCommandList = BatchViewACC; new XMLReaderWriter().BatchSave(GetSelectedBatch(), myBatchCommandList, _myDev.Type); } catch (Exception exception) { MessageBox.Show("Error at Saving Batch " + GetSelectedBatch().ToString() + "!\n" + exception.Message); } }
private void btnOpenBatch_Click(object sender, EventArgs e) { try { int selectedBatch = GetSelectedBatch(); myBatchCommandList = BatchViewACC; if ((myBatchCommandList.myBatchList[selectedBatch - 1].Commands.Count == 0) || (MessageBox.Show("Batch " + GetSelectedBatch().ToString() + "is not empty !\nDo you want to overwrite?", "Error", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)) { myBatchCommandList = new XMLReaderWriter().BatchOpen(GetSelectedBatch(), myBatchCommandList, _myDev.Type); BatchViewACC = myBatchCommandList; } } catch (Exception exception) { MessageBox.Show("Error at Opening Batch " + GetSelectedBatch().ToString() + "!\n" + exception.Message); } }
private void cbbMasterDB_SelectedIndexChanged(object sender, EventArgs e) { try { this.RegisterDGVACC = this._myDev; if (this.dgvRegisterList.Rows.Count > 0) { this.dgvRegisterList.Rows[0].Selected = true; this.dgvRegisterList_SelectionChanged(null, null); } this.myFifoReadWrite = new FifoReadWrite(this._myDev.TxPufferSize, this._myDev.RxPufferSize); this.FifoViewACC = this.myFifoReadWrite; this.myBatchCommandList = new BatchCommandList(); this.BatchViewACC = this.myBatchCommandList; this.myFormStatus = this.FormViewACC; if (!this._isDeviceBusy) { this.ButtonLock(false); } } catch (Exception exception) { MessageBox.Show("Error at Database Selection!\n" + exception.Message); } }
private void reloadRegisterGrid() { try { this.RegisterDGVACC = this._myDev; if (this.dgvRegisterList.Rows.Count > 0) { this.dgvRegisterList.Rows[0].Selected = true; this.dgvRegisterList_SelectionChanged(null, null); } bool flag1 = this._myDev.Notes == ""; this.myFifoReadWrite = new FifoReadWrite(this._myDev.TxPufferSize, this._myDev.RxPufferSize); this.myBatchCommandList = new BatchCommandList(); this.BatchViewACC = this.myBatchCommandList; this.myFormStatus = this.FormViewACC; } catch (Exception exception) { MessageBox.Show("Error at Database Selection!\n" + exception.Message); } }
public void StoreBatch(XmlNode root, BatchCommandList BatchList, int BatchNum, string deviceName) { XmlDocument ownerDocument = root.OwnerDocument; XmlElement newChild = ownerDocument.CreateElement("Batch"); newChild.SetAttribute("device", deviceName); newChild.SetAttribute("name", BatchList.myBatchList[BatchNum - 1].Name); newChild.SetAttribute("loop", BatchList.myBatchList[BatchNum - 1].Loop ? "1" : "0"); for (int i = 0; i < BatchList.myBatchList[BatchNum - 1].Commands.Count; i++) { XmlElement element2 = ownerDocument.CreateElement("Line"); element2.SetAttribute("index", i.ToString()); element2.SetAttribute("value", BatchList.myBatchList[BatchNum - 1].Commands[i]); newChild.AppendChild(element2); } root.AppendChild(newChild); }
public void RestoreBatch(XmlNode root, BatchCommandList BatchList, int BatchNum, string deviceName) { XmlDocument ownerDocument = root.OwnerDocument; XmlNodeList list = root.SelectNodes("Batch"); if ((list.Count > 0) && (list[0].Attributes.GetNamedItem("device").Value.ToString() == deviceName)) { int num = 0; if (list.Count >= BatchNum) { num = BatchNum - 1; } BatchList.myBatchList[BatchNum - 1].Name = list[num].Attributes.GetNamedItem("name").Value.ToString(); BatchList.myBatchList[BatchNum - 1].Loop = list[num].Attributes.GetNamedItem("loop").Value.ToString() == "1"; XmlNodeList list2 = list[num].SelectNodes("Line"); BatchList.myBatchList[BatchNum - 1].Commands.Clear(); foreach (XmlNode node2 in list2) { BatchList.myBatchList[BatchNum - 1].Commands.Add(node2.Attributes.GetNamedItem("value").Value.ToString()); } } }