private void FormSetting_Load(object sender, EventArgs e) { string address; // объявление переменной для адреса счетчика string[] s_out = new string[3]; // массив введенных значений или значений по умолчанию s_out = Parametrs.Parametr(kpProps.CmdLine); LineCmd.Text = kpProps.CmdLine; kpProps.Modified = false; address = s_out[0]; address_1.Text = address; int chanel = Convert.ToInt32(s_out[1], 10); checkBoxUIP.Checked = Parametrs.GetBit(chanel, 0) > 0; checkBoxPr.Checked = Parametrs.GetBit(chanel, 1) > 0; checkBoxCOSPp.Checked = Parametrs.GetBit(chanel, 2) > 0; checkBoxCH.Checked = Parametrs.GetBit(chanel, 3) > 0; checkBoxEA.Checked = Parametrs.GetBit(chanel, 4) > 0; checkBoxER.Checked = Parametrs.GetBit(chanel, 5) > 0; }
private void FormKpRPi_Load(object sender, EventArgs e) { string[] s_out = new string[5]; // массив введенных значений или значений по умолчанию s_out = Parametrs.Parametr(kpProps.CmdLine); LineCmd.Text = kpProps.CmdLine; kpProps.Modified = false; int chanel = Convert.ToInt32(s_out[0], 10); int in_out = Convert.ToInt32(s_out[1], 10); int pullC = Convert.ToInt32(s_out[2], 10); int level = Convert.ToInt32(s_out[3], 10); int comand = Convert.ToInt32(s_out[4], 10); ActivateOut.Checked = Parametrs.GetBit(comand, 0) > 0; Retain.Checked = Parametrs.GetBit(comand, 1) > 0; this.GpioFormat.SelectedIndex = Parametrs.GetBit(comand, 2); for (int i = 4; i < 28; i++) { (Controls["checkGpio" + i.ToString()] as CheckBox).Checked = Parametrs.GetBit(chanel, i - 4) > 0; } for (int i = 4; i < 28; i++) { (Controls["inout" + i.ToString()] as CheckBox).Checked = Parametrs.GetBit(in_out, i - 4) > 0; if ((Controls["inout" + i.ToString()] as CheckBox).Checked) { if (!(Controls["checkGpio" + i.ToString()] as CheckBox).Checked) { (Controls["inout" + i.ToString()] as CheckBox).Enabled = false; } (Controls["inout" + i.ToString()] as CheckBox).Text = "OUT"; } else { if (!(Controls["checkGpio" + i.ToString()] as CheckBox).Checked) { (Controls["inout" + i.ToString()] as CheckBox).Enabled = false; } (Controls["inout" + i.ToString()] as CheckBox).Text = "IN"; } } for (int i = 4; i < 28; i++) { (Controls["pull" + i.ToString()] as CheckBox).Checked = Parametrs.GetBit(pullC, i - 4) > 0; if ((Controls["pull" + i.ToString()] as CheckBox).Checked) { if (!(Controls["checkGpio" + i.ToString()] as CheckBox).Checked) { (Controls["pull" + i.ToString()] as CheckBox).Enabled = false; } (Controls["pull" + i.ToString()] as CheckBox).Text = "UP"; } else { if (!(Controls["checkGpio" + i.ToString()] as CheckBox).Checked) { (Controls["pull" + i.ToString()] as CheckBox).Enabled = false; } (Controls["pull" + i.ToString()] as CheckBox).Text = "Down"; } } for (int i = 4; i < 28; i++) { (Controls["level" + i.ToString()] as CheckBox).Checked = Parametrs.GetBit(level, i - 4) > 0; if ((Controls["level" + i.ToString()] as CheckBox).Checked) { if (!(Controls["checkGpio" + i.ToString()] as CheckBox).Checked) { (Controls["level" + i.ToString()] as CheckBox).Enabled = false; } (Controls["level" + i.ToString()] as CheckBox).Text = "High"; } else { if (!(Controls["checkGpio" + i.ToString()] as CheckBox).Checked) { (Controls["level" + i.ToString()] as CheckBox).Enabled = false; } (Controls["level" + i.ToString()] as CheckBox).Text = "Low"; } } }