private void CallSerialPortSelection()
        {
            try
            {
                //if (IsCameraConnected)
                //    cam.Stop();
                //reader.CloseCom();

                SerialPortSelection PortSelectionForm = new SerialPortSelection(tokenvalue, roleValue);

                // Show PortSelectionForm as a modal dialog and determine if DialogResult = OK.
                if (PortSelectionForm.ShowDialog(this) == DialogResult.OK)
                {
                    // Read the contents of PortSelectionForm's cmbComPortList.
                    portname = PortSelectionForm.cmbComPortList.Text;
                }
                else
                {
                    CallMainMenu();
                }

                PortSelectionForm.Dispose();
                //ReaderMethodProc();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        private void serialPortToolStripMenuItem_Click(object sender, EventArgs e)
        {
            SerialPortSelection serialPort = new SerialPortSelection(tokenvalue, roleValue);

            serialPort.ShowDialog();

            //SerialPortSelection PortSelectionForm = new SerialPortSelection(tokenvalue, roleValue);

            //// Show PortSelectionForm as a modal dialog and determine if DialogResult = OK.
            //if (PortSelectionForm.ShowDialog(this) != DialogResult.OK)
            //{
            //    //if (tabCtrlMainMenu.TabCount != 0)
            //    //{
            //    //    closeCameraAndReader();
            //    //    this.tabCtrlMainMenu.TabPages.Remove(this.tabCtrlMainMenu.SelectedTab);
            //    //}
            //}
        }
        private void CallSerialPortSelection()
        {
            try
            {
                SerialPortSelection PortSelectionForm = new SerialPortSelection(tokenvalue, roleValue);

                // Show PortSelectionForm as a modal dialog and determine if DialogResult = OK.
                if (PortSelectionForm.ShowDialog(this) == DialogResult.OK)
                {
                    // Read the contents of PortSelectionForm's cmbComPortList.
                    portname = PortSelectionForm.cmbComPortList.Text;
                }
                else
                {
                    ValidateRule(); //CallMainMenu();
                }
                PortSelectionForm.Dispose();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }