public CTestExch(object TheControl)
        {
            InitializeComponent();
            Parent = (Control)TheControl;

            CBIP.Items.AddRange(Properties.Settings.Default.asIPs.Split(';'));
            if (Properties.Settings.Default.asIP.Length > 7)
            {
                CBIP.SelectedIndex = CBIP.FindString(Properties.Settings.Default.asIP);
            }
            else
            {
                if (CBIP.Items.Count > 0)
                {
                    CBIP.SelectedIndex = 0;
                }
            }
            TBPort.Text    = Properties.Settings.Default.asPort;
            TBCommand.Text = Properties.Settings.Default.asCommand;

            OutMess = Inv_OutMess;
            CBBaudCOM.SelectedIndex = CBBaudCOM.FindString(Properties.Settings.Default.asBaudCom);
            if (CBBaudCOM.SelectedIndex == -1)
            {
                CBBaudCOM.SelectedIndex = 0;
            }
            NUDTimeout.Value = Properties.Settings.Default.dTimeoutBetwen;
            UDCOM.Value      = Properties.Settings.Default.mComPort;

            CBParity.Items.AddRange(Enum.GetNames(typeof(System.IO.Ports.Parity)));
            CBParity.SelectedIndex = Properties.Settings.Default.iParity;
            CBStopBits.Items.AddRange(Enum.GetNames(typeof(System.IO.Ports.StopBits)));
            CBStopBits.SelectedIndex = Properties.Settings.Default.iStopBits;
            NUDDataBits.Value        = Properties.Settings.Default.iDataBits;
            //ReSize ();
            BeginDopFunc = new SPDopFunc(PDopFunc.Top, PDopFunc.Width, PDopFunc.Height);

            NUDFontSize.Value = (decimal)TBListExchange.Font.Size;

            CBDev.Items.AddRange(Enum.GetNames(typeof(DEVICE)));
            CBDev.SelectedIndex = CBDev.FindString(Properties.Settings.Default.asDevExch);
            if (CBDev.SelectedIndex < 0)
            {
                CBDev.SelectedIndex = 0;
            }
        }
        //___________________________________________________________________________
        private void BConnect_Click(object sender, EventArgs e)
        {
            if (Прибор == null)
            {
                if (int.TryParse(TBPort.Text, out iPort))
                {
                    Прибор = new CIRGA2(this);
                }
                else
                {
                    Inv_OutMess("Неправильный номер порта: [" + TBPort.Text + "]", "");
                    return;
                }
            }
            Properties.Settings.Default.asPort = TBPort.Text;
            Properties.Settings.Default.asIP   = CBIP.Text;
            if (CBIP.FindString(CBIP.Text) < 0)
            {
                CBIP.Items.Add(CBIP.Text);
                Properties.Settings.Default.asIPs += ";" + CBIP.Text;
            }
            if (Properties.Settings.Default.asCommand.Contains(TBCommand.Text) == false)
            {
                Properties.Settings.Default.asCommand = TBCommand.Text;
            }
            Прибор.InitIPport(CBIP.Text, iPort);

            ThreadPool.QueueUserWorkItem((Object oInfo) =>
            {
                Inv_OutMess($"Подключение к {GetTextCB (CBIP)} ...", "");
                if (ConnDev(oInfo) == false)
                {
                    Прибор = null;
                }
            }
                                         , sender);
        }
 //_____________________________________________________________
 private void BRequest_Click(object sender, EventArgs e)
 {
     if (int.TryParse(TBPort.Text, out iPort))
     {
         Properties.Settings.Default.asPort = TBPort.Text;
         Properties.Settings.Default.asIP   = CBIP.Text;
         if (CBIP.FindString(CBIP.Text) < 0)
         {
             CBIP.Items.Add(CBIP.Text);
             Properties.Settings.Default.asIPs += ";" + CBIP.Text;
         }
         Properties.Settings.Default.asCommand = TBCommand.Text;
         //switch ((EDevice)CBDevice.SelectedIndex)
         //{
         //case EDevice.ИРГА2: RequestIRGA2 (); break;
         //default: break;
         //}
         Request();
     }
     else
     {
         MessageBox.Show("Неправильный номер порта: [" + TBPort.Text + "]");
     }
 }