private void btnWrite_Click(object sender, EventArgs e) { CommPrgForm commPrgForm = new CommPrgForm(); commPrgForm.StartPosition = FormStartPosition.CenterParent; commPrgForm.IsRead = false; MainForm.startAddress = int.Parse(txtStartAddr.Text, System.Globalization.NumberStyles.HexNumber); if (MainForm.startAddress % 32 != 0) { MessageBox.Show("Start address must be a multiple of 0x20"); return; } MainForm.transferLength = int.Parse(txtLen.Text, System.Globalization.NumberStyles.HexNumber); if (MainForm.transferLength % 32 != 0) { MessageBox.Show("Length must be a multplie of 0x20"); return; } if (MainForm.startAddress + MainForm.transferLength > MainForm.eeprom.Length) { MessageBox.Show("Start address and length settings would result in writing beyond the end of memory"); return; } copyHexboxToEeprom(); commPrgForm.ShowDialog(); }
private void btnRead_Click(object sender, EventArgs e) { CommPrgForm commPrgForm = new CommPrgForm(); commPrgForm.StartPosition = FormStartPosition.CenterParent; commPrgForm.IsRead = true; MainForm.startAddress = int.Parse(txtStartAddr.Text, System.Globalization.NumberStyles.HexNumber); if (MainForm.startAddress % 32 != 0) { MessageBox.Show("Start address must be a multiple of 0x20"); return; } MainForm.transferLength = int.Parse(txtLen.Text, System.Globalization.NumberStyles.HexNumber); if (MainForm.transferLength == 0) { MessageBox.Show("Length cant be zero"); return; } if (MainForm.transferLength % 32 != 0) { MessageBox.Show("Length must be a multplie of 0x20"); return; } if (MainForm.startAddress + MainForm.transferLength > MainForm.eeprom.Length) { MessageBox.Show("Start address and length settings would result in reading beyond the end of memory"); return; } commPrgForm.ShowDialog(); hexBox.ByteProvider = _dbp = new FixedByteProvider(eeprom); _hexboxHasChanged = false; }
private void btnWriteCalibration_Click(object sender, EventArgs e) { hexBox.ScrollByteToTop(0x8F000); CommPrgForm commPrgForm = new CommPrgForm(); commPrgForm.StartPosition = FormStartPosition.CenterParent; commPrgForm.IsRead = false; MainForm.startAddress = 0x80000; MainForm.transferLength = 0x10000; copyHexboxToEeprom(); commPrgForm.ShowDialog(); }
private void btnReadCalibration_Click(object sender, EventArgs e) { CommPrgForm commPrgForm = new CommPrgForm(); commPrgForm.StartPosition = FormStartPosition.CenterParent; commPrgForm.IsRead = true; MainForm.startAddress = 0x80000; MainForm.transferLength = 0x10000; commPrgForm.ShowDialog(); hexBox.ByteProvider = _dbp = new FixedByteProvider(CommsBuffer); hexBox.ScrollByteToTop(0x8F000); _hexboxHasChanged = false; }