コード例 #1
0
ファイル: MainForm.cs プロジェクト: Nazir/EqGate-2008
        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();
        }
コード例 #2
0
ファイル: MainForm.cs プロジェクト: Nazir/EqGate-2008
        public bool CheckSession(bool ShowMsg)
        {
            textBox_Session_Info.Clear();
            if (!EQGateDLL.ServerConnected)
            {
                if (ShowMsg)
                {
                    MessageBox.Show("Сессия не активна!!!\nНет подключения к серверу!", "Информация", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
                return(false);
            }
            // Проверка статуса сессии
            StringBuilder sb_input = new StringBuilder(0);

            sb_input = sb_input.Append(" ");

            if (EQGateDLL.Request("YPING0R", sb_input, "") != true)
            {
                textBox_SessionID.Text = EQGateDLL.SessionID;
                ShowErrorsWarnings(true); // Ошибки/Предупреждения
                textBox_Session_Info.ForeColor = Color.FromName("Orange");
                textBox_Session_Info.Text      = "Сессия не активна!!!";
                if (ShowMsg)
                {
                    MessageBox.Show("Сессия не активна!!!", "Информация", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
                return(false);
            }
            //
            if (EQGateDLL.RequestOutput.ToString(0, 1) != "1")
            {
                textBox_SessionID.Text = EQGateDLL.SessionID;
                ShowErrorsWarnings(true); // Ошибки/Предупреждения
                textBox_Session_Info.ForeColor = Color.FromName("Orange");
                textBox_Session_Info.Text      = "Сессия не активна!!!";
                if (ShowMsg)
                {
                    MessageBox.Show("Сессия не активна!!!", "Информация", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
                return(false);
            }

            textBox_Session_Info.ForeColor = Color.FromName("Green");
            textBox_Session_Info.Text      = "Готово";
            textBox_SessionID.Text         = EQGateDLL.SessionID;
            textBox_EQGateStatus.Text      = EQGateDLL.GetEQGateStatus(-1);
            listView_Errors_Warnings.Items.Clear();
            if (ShowMsg)
            {
                MessageBox.Show("Сессия активна!!!", "Информация", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            return(true);
        }
コード例 #3
0
ファイル: MainForm.cs プロジェクト: Nazir/EqGate-2008
 private void DisconnectNow()
 {
     // Закрытие соединения
     if (EQGateDLL.Disconnect() != true)
     {
         textBox_EQGateStatus.Text = EQGateDLL.GetEQGateStatus(-1);
         return;
     }
     toolStripStatusLabel_ConnectionStatus.ForeColor = Color.FromName("Red");
     toolStripStatusLabel_ConnectionStatus.Text      = "Отключено";
     groupBox_Connect.Enabled     = true;
     groupBox_OpenSession.Enabled = false;
     groupBox_Disconnect.Enabled  = false;
     button_Connect.Image         = imageList_Main.Images["start.png"];// EqGate.Properties.Resources.start;
 }
コード例 #4
0
ファイル: MainForm.cs プロジェクト: Nazir/EqGate-2008
 public void CloseSession()
 {
     // Закрытие сессии
     if (EQGateDLL.CloseSession() != true)
     {
         textBox_SessionID.Text = EQGateDLL.SessionID;
         ShowErrorsWarnings(true); // Ошибки/Предупреждения
         return;
     }
     textBox_Session_Info.ForeColor = Color.FromName("Green");
     textBox_Session_Info.Text      = "Готово";
     textBox_SessionID.Text         = EQGateDLL.SessionID;
     groupBox_OpenSession.Enabled   = true;
     groupBox_CloseSession.Enabled  = false;
     groupBox_Disconnect.Enabled    = true;
     textBox_EQGateStatus.Text      = EQGateDLL.GetEQGateStatus(-1);
     button_Open.Image = imageList_Main.Images["start.png"]; //EqGate.Properties.Resources.start;
 }
コード例 #5
0
ファイル: MainForm.cs プロジェクト: Nazir/EqGate-2008
 public void OpenSession()
 {
     // Открытие сессии
     if (EQGateDLL.OpenSession(comboBox_DB.Text, comboBox_User.Text, maskedTextBox_Password.Text) != true)
     {
         textBox_SessionID.Text = EQGateDLL.SessionID;
         ShowErrorsWarnings(true);                                    // Ошибки/Предупреждения
         button_Open.Image      = imageList_Main.Images["start.png"]; //EqGate.Properties.Resources.start;
         Cursor                 = Cursors.Default;
         textBox_SessionID.Text = EQGateDLL.SessionID;
         return;
     }
     //
     textBox_Session_Info.ForeColor = Color.FromName("Green");
     textBox_Session_Info.Text      = "Готово";
     textBox_SessionID.Text         = EQGateDLL.SessionID;
     groupBox_OpenSession.Enabled   = false;
     groupBox_CloseSession.Enabled  = true;
     groupBox_Disconnect.Enabled    = false;
     textBox_EQGateStatus.Text      = EQGateDLL.GetEQGateStatus(-1);
 }
コード例 #6
0
ファイル: MainForm.cs プロジェクト: Nazir/EqGate-2008
        private void ShowErrorsWarnings(bool bClear)
        {
            // Ошибки/Предупреждения
            if (bClear)
            {
                listView_Errors_Warnings.Items.Clear();
            }
            int Count = EQGateDLL.ksm_Code.Rank;

            for (int iCounter = 0; iCounter < Count; iCounter++)
            {
                ListViewItem item1 = new ListViewItem(Convert.ToString(iCounter + 1), 0);
                item1.SubItems.Add(EQGateDLL.ksm_Code[iCounter]);
                item1.SubItems.Add(EQGateDLL.ksm_Severity[iCounter]);
                item1.SubItems.Add(EQGateDLL.ksm_Text[iCounter]);
                listView_Errors_Warnings.Items.AddRange(new ListViewItem[] { item1 });
            }
            //listView_Errors_Warnings.Columns[0].ListView.Items.Add(EQGateDLL.ksm_Code);
            textBox_Session_Info.ForeColor = Color.FromName("Red");
            textBox_Session_Info.Text      = " Ошибки/Предупреждения";
            textBox_EQGateStatus.Text      = EQGateDLL.GetEQGateStatus(-1);
        }