예제 #1
0
        //-------------------------------------------------------------------------------------------------
        private void Button_Connect_Click(object sender, RoutedEventArgs e)
        {
            string strIp   = Text_IP.Text.ToString();
            string strPort = Text_PORT.Text.ToString();
            int    nPort   = 0;

            if (m_bConnect)
            {
                return;
            }

            //AcsApi = new Api();
            if (AcsApi == null)
            {
                AcsApi = new Api();
                mc_Acs = new ACSControl(AcsApi);
            }

            m_bConnect = false;

            if (mc_Acs != null)
            {
                mc_Acs.fn_CloseACS();                 //Close
            }
            if (m_nComType == 0)
            {
                if (strIp == null || strIp == "")
                {
                    return;
                }
                if (strPort == null || strPort == "")
                {
                    return;
                }
                nPort      = Convert.ToInt32(strPort);
                m_bConnect = mc_Acs.fn_OnConnectTCP(strIp, nPort);
            }
            else if (m_nComType == 1)
            {
                m_bConnect = mc_Acs.fn_OnConnectSimulator();
            }
            else
            {
                m_bConnect = false;
            }

            //
            if (!m_bConnect)
            {
                MessageBox.Show("ACS MOTOR에 연결 할 수 없습니다.!!!!", "[ERROR]");
            }
        }