Exemplo n.º 1
0
        private void bt_saveCalibPoint_Click(object sender, EventArgs e)
        {
            Properties.Settings.Default.Batch     = tb_batch.Text;
            Properties.Settings.Default.FwVersion = tb_fwVersion.Text;
            try { Properties.Settings.Default.StationId = Int32.Parse(tb_stationId.Text); } catch { }
            Properties.Settings.Default.UserId = tb_userName.Text;

            calibForm.classCalibrationInfo.classCalibrationSettings.TempUnderTestList.Clear();
            calibForm.classCalibrationInfo.classCalibrationSettings.PressureUnderTestList.Clear();
            calibForm.classCalibrationInfo.classCalibrationSettings.TempSkipStartTime.Clear();


            calibForm.classCalibrationInfo.classCalibrationSettings.Versions.DpFw = tb_fwVersion.Text;

            //save temp points
            for (int i = 0; i < dgv_calibTempPointsTable.Rows.Count; i++)
            {
                DataGridViewCheckBoxCell EnabelTempCell = new DataGridViewCheckBoxCell();
                EnabelTempCell = (DataGridViewCheckBoxCell)dgv_calibTempPointsTable.Rows[i].Cells[0];

                if (EnabelTempCell.Value != null)
                {
                    if ((bool)(dgv_calibTempPointsTable.Rows[i].Cells[0].Value))
                    {
                        calibForm.classCalibrationInfo.classCalibrationSettings.TempUnderTestList.Add(float.Parse(dgv_calibTempPointsTable.Rows[i].Cells[1].Value.ToString()));
                        calibForm.classCalibrationInfo.classCalibrationSettings.TempSkipStartTime.Add(Int32.Parse(dgv_calibTempPointsTable.Rows[i].Cells[2].Value.ToString()) * 60);
                    }
                }
            }



            //save pressure points
            for (int i = 0; i < dgv_calibPressuresPointsTable.Rows.Count; i++)
            {
                DataGridViewCheckBoxCell EnabelTempCell = new DataGridViewCheckBoxCell();
                EnabelTempCell = (DataGridViewCheckBoxCell)dgv_calibPressuresPointsTable.Rows[i].Cells[0];
                if (EnabelTempCell.Value != null)
                {
                    if ((bool)(dgv_calibPressuresPointsTable.Rows[i].Cells[0].Value))
                    {
                        calibForm.classCalibrationInfo.classCalibrationSettings.PressureUnderTestList.Add(float.Parse(dgv_calibPressuresPointsTable.Rows[i].Cells[1].Value.ToString()));
                    }
                }
            }


            // update jig configuration
            if (cmb_jigConfiguration.SelectedItem != null)
            {
                if (cmb_jigConfiguration.SelectedItem.ToString() != "")
                {
                    calibForm.classCalibrationInfo.classCalibrationSettings.JigConfiguration = int.Parse(cmb_jigConfiguration.SelectedItem.ToString());
                }
                else
                {
                    calibForm.classCalibrationInfo.classCalibrationSettings.JigConfiguration = 8;
                }
            }
            else
            {
                calibForm.classCalibrationInfo.classCalibrationSettings.JigConfiguration = 8;
            }

            // update temp sample settings
            calibForm.classCalibrationInfo.classCalibrationSettings.TempSampleInterval = Convert.ToInt32(tb_temSpampleInterval.Text);
            calibForm.classCalibrationInfo.classCalibrationSettings.TempDeltaRange     = float.Parse(tb_tempDeltaRange.Text);
            calibForm.classCalibrationInfo.classCalibrationSettings.MaxTimeWaitToTemp  = Convert.ToInt32(tb_tempMaxWaitTime.Text) * 60;
            calibForm.classCalibrationInfo.classCalibrationSettings.TempSampleAmount   = Convert.ToInt32(tb_tempSampleNum.Text);



            //update license type

            byte _capabilities = 0;

            _capabilities |= chkDPS.Checked ? (byte)LICENSE_BITS.DPS : (byte)0;
            _capabilities |= chkDPT.Checked ? (byte)LICENSE_BITS.DPT : (byte)0;
            _capabilities |= chkPS.Checked ? (byte)LICENSE_BITS.PS : (byte)0;
            _capabilities |= chkPT.Checked ? (byte)LICENSE_BITS.PT : (byte)0;
            _capabilities |= chkDataLogger.Checked ? (byte)LICENSE_BITS.DATA_LOGGER : (byte)0;
            _capabilities |= chkWash.Checked ? (byte)LICENSE_BITS.WASH_CONTROL : (byte)0;
            calibForm.classCalibrationInfo.classCalibrationSettings.DeviceLicens = _capabilities.ToString("X2");
            calibForm.UpdateTraceInfo("Current license is " + calibForm.classCalibrationInfo.classCalibrationSettings.DeviceLicens + "\r\n");
            //save station detiles
            calibForm.classCalibrationInfo.classCalibrationSettings.UserName  = tb_userName.Text;
            calibForm.classCalibrationInfo.classCalibrationSettings.StationId = int.Parse(tb_stationId.Text);

            //save batch
            calibForm.classCalibrationInfo.classCalibrationSettings.Batch = tb_batch.Text;

            calibForm.showScanButton();

            this.Hide();
            calibForm.Show();
        }