private void downloadToPlcToolStripMenuItem_Click(object sender, EventArgs e) { DialogResult dr = MessageBox.Show("Do you want to erase the existing PLC program first?", "Erase PLC?", MessageBoxButtons.YesNo); if (dr == DialogResult.Yes) { try { MyCpu.erase(); } catch (wPlcException ex) { showErrorForException(ex); } } wldFile w = new wldFile(); bool result = w.openFromFile(); if (result == true) { List <Tuple <wSubBlockType, int, List <byte> > > blockList = w.decode(); try { foreach (Tuple <wSubBlockType, int, List <byte> > b in blockList) { MyCpu.downloadBlock(b.Item3); } } catch (wPlcException ex) { showErrorForException(ex); } MessageBox.Show("Program sucessfullly downloaded to PLC"); } else { MessageBox.Show("Error opening WLD file"); } refreshCpuInformation(); }
public wCpu(wldFile w) { blocks = new List<wCpuBlock>(); }
private void saveToDiskToolStripMenuItem_Click(object sender, EventArgs e) { wldFile w = new wldFile(MyCpu); w.save(); }
private void downloadToPlcToolStripMenuItem_Click(object sender, EventArgs e) { DialogResult dr = MessageBox.Show("Do you want to erase the existing PLC program first?", "Erase PLC?", MessageBoxButtons.YesNo); if (dr == DialogResult.Yes) { try { MyCpu.erase(); } catch (wPlcException ex) { showErrorForException(ex); } } wldFile w = new wldFile(); bool result = w.openFromFile(); if (result == true) { List<Tuple<wSubBlockType, int, List<byte>>> blockList = w.decode(); try { foreach (Tuple<wSubBlockType, int, List<byte>> b in blockList) { MyCpu.downloadBlock(b.Item3); } } catch (wPlcException ex) { showErrorForException(ex); } MessageBox.Show("Program sucessfullly downloaded to PLC"); } else { MessageBox.Show("Error opening WLD file"); } refreshCpuInformation(); }
public wCpu(wldFile w) { blocks = new List <wCpuBlock>(); }