private void btnSet_Click(object sender, EventArgs e) { CoreSerialize cs = new CoreSerialize(); TParameters tp = new TParameters() { lastTime_1 = double.Parse(tbLastTime_1.Text), intervalTime_1 = double.Parse(tbIntervalTime_1.Text), circle_1 = int.Parse(tbCircle_1.Text), voltage_1 = double.Parse(tbVoltage_1.Text), lastTime_2 = double.Parse(tbLastTime_2.Text), intervalTime_2 = double.Parse(tbIntervalTime_2.Text), circle_2 = int.Parse(tbCircle_2.Text), voltage_2 = double.Parse(tbVoltage_2.Text), lastTime_3 = double.Parse(tbLastTime_3.Text), intervalTime_3 = double.Parse(tbIntervalTime_3.Text), circle_3 = int.Parse(tbCircle_3.Text), voltage_3 = double.Parse(tbVoltage_3.Text), lastTime_4 = double.Parse(tbLastTime_4.Text), intervalTime_4 = double.Parse(tbIntervalTime_4.Text), circle_4 = int.Parse(tbCircle_4.Text), voltage_4 = double.Parse(tbVoltage_4.Text), }; cs.TParammSerializeNow(tp); }
private void Form1_Load(object sender, EventArgs e) { board.AnalogPortConfigurationOut(); board.DigitalConfigurationOut(); timer1.Interval = 100; timer2.Interval = 100; board.DigitOutput(0, MccDaq.DigitalLogicState.Low); CoreSerialize cs = new CoreSerialize(); TParameters dataT = new TParameters(); try { dataT = cs.TParamDeSerializeNow(); tbLastTime_1.Text = dataT.lastTime_1.ToString(); tbIntervalTime_1.Text = dataT.intervalTime_1.ToString(); tbCircle_1.Text = dataT.circle_1.ToString(); tbVoltage_1.Text = dataT.voltage_1.ToString(); tbLastTime_2.Text = dataT.lastTime_2.ToString(); tbIntervalTime_2.Text = dataT.intervalTime_2.ToString(); tbCircle_2.Text = dataT.circle_2.ToString(); tbVoltage_2.Text = dataT.voltage_2.ToString(); tbLastTime_3.Text = dataT.lastTime_3.ToString(); tbIntervalTime_3.Text = dataT.intervalTime_3.ToString(); tbCircle_3.Text = dataT.circle_3.ToString(); tbVoltage_3.Text = dataT.voltage_3.ToString(); tbLastTime_4.Text = dataT.lastTime_4.ToString(); tbIntervalTime_4.Text = dataT.intervalTime_4.ToString(); tbCircle_4.Text = dataT.circle_4.ToString(); tbVoltage_4.Text = dataT.voltage_4.ToString(); } catch { TParameters tp = new TParameters() { lastTime_1 = 3, intervalTime_1 = 3, circle_1 = 3, voltage_1 = 3.5, lastTime_2 = 3, intervalTime_2 = 3, circle_2 = 3, voltage_2 = 3.5, lastTime_3 = 3, intervalTime_3 = 3, circle_3 = 3, voltage_3 = 3.5, lastTime_4 = 3, intervalTime_4 = 3, circle_4 = 3, voltage_4 = 3.5, }; cs.TParammSerializeNow(tp); dataT = cs.TParamDeSerializeNow(); tbLastTime_1.Text = dataT.lastTime_1.ToString(); tbIntervalTime_1.Text = dataT.intervalTime_1.ToString(); tbCircle_1.Text = dataT.circle_1.ToString(); tbVoltage_1.Text = dataT.voltage_1.ToString(); tbLastTime_2.Text = dataT.lastTime_2.ToString(); tbIntervalTime_2.Text = dataT.intervalTime_2.ToString(); tbCircle_2.Text = dataT.circle_2.ToString(); tbVoltage_2.Text = dataT.voltage_2.ToString(); tbLastTime_3.Text = dataT.lastTime_3.ToString(); tbIntervalTime_3.Text = dataT.intervalTime_3.ToString(); tbCircle_3.Text = dataT.circle_3.ToString(); tbVoltage_3.Text = dataT.voltage_3.ToString(); tbLastTime_4.Text = dataT.lastTime_4.ToString(); tbIntervalTime_4.Text = dataT.intervalTime_4.ToString(); tbCircle_4.Text = dataT.circle_4.ToString(); tbVoltage_4.Text = dataT.voltage_4.ToString(); } }