private void button_Connect_Click(object sender, EventArgs e) { // Открытие соединения button_Connect.Image = imageList_Main.Images["spinner.gif"]; // EqGate.Properties.Resources.spinner; Cursor = Cursors.WaitCursor; // splitContainer_Main.Enabled = false; toolStripProgressBar.Visible = true; EQGateDLL.EQHost = comboBox_Host.Text; EQGateDLL.EQPort = Convert.ToInt32(comboBox_Port.Text); Thread t = new Thread(new ThreadStart(Connect)); t.Start(); toolStripProgressBar.Maximum = 100; toolStripProgressBar.Value = 0; toolStripProgressBar.Step = 10; while (EQGateDLL.EQGateStatus < 0) { if (toolStripProgressBar.Value >= toolStripProgressBar.Maximum) { toolStripProgressBar.Value = 0; } toolStripProgressBar.Value += 10; Thread.Sleep(0); } t.Join(); if (EQGateDLL.EQGateStatus != 0) { textBox_EQGateStatus.Text = EQGateDLL.GetEQGateStatus(-1); splitContainer_Main.Enabled = true; toolStripStatusLabel_ConnectionStatus.ForeColor = Color.FromName("Red"); toolStripStatusLabel_ConnectionStatus.Text = "Отключено"; button_Connect.Image = imageList_Main.Images["start.png"];// EqGate.Properties.Resources.start; Cursor = Cursors.Default; toolStripProgressBar.Visible = false; return; } toolStripProgressBar.Visible = false; splitContainer_Main.Enabled = true; Cursor = Cursors.Default; button_Connect.Image = imageList_Main.Images["apply.png"]; // EqGate.Properties.Resources.apply; // toolStripStatusLabel_ConnectionStatus.ForeColor = Color.FromName("Green"); toolStripStatusLabel_ConnectionStatus.Text = "Подключено"; groupBox_Connect.Enabled = false; groupBox_Disconnect.Enabled = true; groupBox_OpenSession.Enabled = true; // Определение версии сервера toolStripStatusLabel_ServerVersion.Text = "Версия сервера: " + EQGateDLL.GetServerVersion(); }