private void rbo_CheckedChanged(object sender, EventArgs e) { RadioButton button = (RadioButton)sender; if (button.Checked) { _currentRegisterAddress = Convert.ToInt32(button.Name.Substring(2, button.Name.Length - 2), 16); CurrentRegister = RegisterMap[_currentRegisterAddress]; _uxRegisterGB.Text = CurrentRegister.Description; for (int bitIdx = 0; bitIdx <= 7; bitIdx++) { try { _uxTable.Controls["uxDescriptionBit" + bitIdx.ToString()].Text = CurrentRegister.BitFieldName[bitIdx]; } catch (Exception) { _uxTable.Controls["uxDescriptionBit" + bitIdx.ToString()].Text = ""; } _uxTable.Controls["uxLedBit" + bitIdx.ToString()].Enabled = CurrentRegister.Type.IsRW(); } _uxTable.Controls["uxType"].Text = CurrentRegister.Type.Rw; _uxComment.Text = CurrentRegister.Comment; if (RegisterChange != null) { RegisterChange(CurrentRegister); } } }
public void ParseMap(string map) { string[] lines = map.Replace("\r\n", "\n").Split(new char[] { '\n' }); RadioButton sender = null; for (int i = 0; i < lines.Length; i++) { if (lines[i].Equals(_rowSeparator)) { _uxNotes.Text = ""; for (int j = i + 1; j < lines.Length; j++) { _uxNotes.Text = _uxNotes.Text + lines[j] + "\n"; } break; } string[] strArray2 = lines[i].TrimEnd(new char[] { '\r' }).Split(new char[] { '\t' }); RadioButton button2 = new RadioButton { Name = "rb" + strArray2[0] }; if (i == 0) { button2.Checked = true; sender = button2; } RegisterSTB rstb = new RegisterSTB(); rstb.Address = Convert.ToInt32(strArray2[0], 16); rstb.Name = strArray2[1]; rstb.Description = strArray2[2]; rstb.Comment = strArray2[5].Replace('|', ' '); rstb.BitFieldName = strArray2[6].Split(new char[] { ',' }); Array.Reverse(rstb.BitFieldName); rstb.Type.Value = (RegisterOptions)Convert.ToInt32(strArray2[4]); rstb.Type.Rw = strArray2[3]; RegisterMap.Add(rstb.Address, rstb); button2.Font = new Font(FontName, (float)RadioButtonFontSize, FontStyle.Regular); button2.Text = string.Format("{0} {1}", strArray2[0], rstb.Name); button2.ForeColor = Color.Black; button2.AutoSize = true; button2.CheckedChanged += new EventHandler(rbo_CheckedChanged); _uxRbPanel.Controls.Add(button2); } ButtonExportRegisters = new Button(); ButtonExportRegisters.Text = "Export All Records"; ButtonExportRegisters.AutoSize = true; ButtonExportRegisters.BackColor = Color.Gray; ButtonExportRegisters.ForeColor = Color.Black; _uxRbPanel.Controls.Add(ButtonExportRegisters); rbo_CheckedChanged(sender, null); }