private void btnEdit_Click(object sender, EventArgs e)
        {
            string strRoutineName = "btnEdit_Click";

            try
            {
                ucspc.lvSPorts.SelectedItems.Clear();
                if (ucspc.lvSPorts.CheckedItems.Count != 1)
                {
                    MessageBox.Show("Select Single Element To Update Serial Configuration !!!", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
                else
                {
                    for (int i = 0; i < ucspc.lvSPorts.Items.Count; i++)
                    {
                        if (ucspc.lvSPorts.Items[i].Checked)
                        {
                            serial = siList.ElementAt(i);
                            ListViewItem lvi = ucspc.lvSPorts.CheckedItems[0];
                            Utils.UncheckOthers(ucspc.lvSPorts, lvi.Index);
                            ucspc.grpSI.Visible = true;
                            mode      = Mode.EDIT;
                            editIndex = i;
                            Utils.showNavigation(ucspc.grpSI, true);
                            loadValues();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(strRoutineName + ": " + "Error: " + ex.Message.ToString(), Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void loadValues()
        {
            string strRoutineName = "loadValues";

            try
            {
                SerialInterface si = siList.ElementAt(editIndex);
                if (si != null)
                {
                    ucspc.txtPortNo.Text               = si.PortNum;
                    ucspc.cmbBaudRate.SelectedIndex    = ucspc.cmbBaudRate.FindStringExact(si.BaudRate);
                    ucspc.cmbDatabits.SelectedIndex    = ucspc.cmbDatabits.FindStringExact(si.Databits);
                    ucspc.cmbStopbits.SelectedIndex    = ucspc.cmbStopbits.FindStringExact(si.Stopbits);
                    ucspc.cmbFlowControl.SelectedIndex = ucspc.cmbFlowControl.FindStringExact(si.FlowControl);
                    ucspc.cmbParity.SelectedIndex      = ucspc.cmbParity.FindStringExact(si.Parity);
                    ucspc.txtRTSPreTime.Text           = si.RtsPreTime;
                    ucspc.txtRTSPostTime.Text          = si.RtsPostTime;
                    ucspc.txtPortName.Text             = si.PortName;
                    ucspc.txtTcpPort.Text              = si.TcpPort;
                    //Namrata: 14/09/2017
                    if (si.Enable.ToLower() == "yes")
                    {
                        ucspc.chkEnable.Checked = true;
                    }
                    else
                    {
                        ucspc.chkEnable.Checked = false;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(strRoutineName + ": " + "Error: " + ex.Message.ToString(), Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void fillOptions()
        {
            string strRoutineName = "fillOptions";

            try
            {
                //Fill Baudrate...
                ucspc.cmbBaudRate.Items.Clear();
                foreach (String br in SerialInterface.getBaudRates())
                {
                    ucspc.cmbBaudRate.Items.Add(br.ToString());
                }
                ucspc.cmbBaudRate.SelectedIndex = 0;

                //Fill Databits...
                ucspc.cmbDatabits.Items.Clear();
                foreach (String db in SerialInterface.getDataBits())
                {
                    ucspc.cmbDatabits.Items.Add(db.ToString());
                }
                ucspc.cmbDatabits.SelectedIndex = 0;

                //Fill Stopbits...
                ucspc.cmbStopbits.Items.Clear();
                foreach (String sb in SerialInterface.getStopBits())
                {
                    ucspc.cmbStopbits.Items.Add(sb.ToString());
                }
                ucspc.cmbStopbits.SelectedIndex = 0;

                //Fill FlowControl...
                ucspc.cmbFlowControl.Items.Clear();
                foreach (String fc in SerialInterface.getFlowControls())
                {
                    ucspc.cmbFlowControl.Items.Add(fc.ToString());
                }
                ucspc.cmbFlowControl.SelectedIndex = 0;

                //Fill Parity...
                ucspc.cmbParity.Items.Clear();
                foreach (String pr in SerialInterface.getParities())
                {
                    ucspc.cmbParity.Items.Add(pr.ToString());
                }
                ucspc.cmbParity.SelectedIndex = 0;
            }
            catch (Exception ex)
            {
                MessageBox.Show(strRoutineName + ": " + "Error: " + ex.Message.ToString(), Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }