예제 #1
0
        private void butSaveEdit_Click(object sender, EventArgs e)
        {
            if (butSaveEdit.Text == "Close")
            {
                this.Close();
            }
            else
            {
                try
                {
                    clsSensor Sen = Sensors.Item(Convert.ToInt16(NV(0)));

                    byte Rslt = 0;
                    byte.TryParse(tbCable.Text, out Rslt);
                    Sen.CableNum = Rslt;

                    Rslt = 0;
                    byte.TryParse(tbSensor.Text, out Rslt);
                    Sen.SensorNum = Rslt;

                    float Flt = 0;
                    float.TryParse(tbOffset.Text, out Flt);
                    Sen.OffSet = Flt;

                    Rslt = 0;
                    byte.TryParse(tbBin.Text, out Rslt);
                    Sen.BinNum = Rslt;

                    Sen.Enabled = ckEnabled.Checked;

                    Sen.Save();
                    LoadData();

                    CurrentRow      = mf.Tls.FindRecord(DGV, 0, Sen.ID);
                    DGV.CurrentCell = DGV[2, CurrentRow];
                }
                catch (Exception ex)
                {
                    if (ex is ArgumentException)
                    {
                        mf.Tls.TimedMessageBox(ex.Message);
                    }
                    else
                    {
                        WriteEvent(ex.Message, false);
                        mf.Tls.WriteErrorLog("frmSensors:butSaveEdit_Click " + ex.Message);
                    }
                }
                UpdateDisplay();
                SetButtons(false);
            }
        }