Exemplo n.º 1
0
        private void 로그인ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Login        myLogin = new Login(실계좌여부);
            DialogResult result  = myLogin.ShowDialog();

            if (result == DialogResult.OK)
            {
                for (int i = LoadedForm.Count - 1; i >= 0; i--)
                {
                    LoadedForm[i].Close();
                }
                //메뉴항목 비활성화
                계좌리스트ToolStripMenuItem.Enabled  = false;
                거래내역조회ToolStripMenuItem.Enabled = false;
                증거금조회ToolStripMenuItem.Enabled  = false;
                잔고조회ToolStripMenuItem.Enabled   = false;
                주문ToolStripMenuItem.Enabled     = false;
                시세ToolStripMenuItem.Enabled     = false;

                if (myXASessionClass.Login(myLogin.txt_고객ID.Text.Trim(), myLogin.txt_비밀번호.Text.Trim(), myLogin.txt_공인인증.Text.Trim(), 0, false))
                {
                    toolStripStatusLabel1.Text = "Login 전송 성공.";
                }
                else
                {
                    toolStripStatusLabel1.Text = "Login 전송 실패.";
                }
            }
        }
Exemplo n.º 2
0
        private void Connect_Click(object sender, EventArgs e)
        {
            bool isConnected = session.IsConnected();

            if (isConnected == false)
            {
                // 접속 URL 셋업
                if (chkPaperTrading.Checked)
                {
                    // 모의투자인 경우 접속하는 URL이 다름
                    ConnectURL = "demo.etrade.co.kr";
                    // session.ConnectServer("demo.ebestsec.co.kr", 20001);
                }
                else
                {
                    // 실거래는 여기로 접속되도록 처리
                    ConnectURL = "hts.etrade.co.kr";
                    // session.ConnectServer("hts.ebestsec.co.kr", 20001);
                }
                // 접속요청
                bool bSession = session.ConnectServer(ConnectURL, 20001);
                if (bSession == true)
                {
                    // 연결 정상, 로그인 요청
                    // 인풋값중 맨 마지막 boolean 값은 공인인증서 에러 표시위한 옵션.
                    if (session.Login(txtID.Text, txtPassword.Text, txtPasswordIn.Text, 0, false))
                    {
                        LogBox.Items.Add("로그인 서버전송 완료");
                    }
                    else
                    {
                        // 로그인 요청안됨. 에러
                        LogBox.Items.Add("로그인 서버전송에 실패하였습니다.");
                    }
                }
                else
                {
                    // 연결 비정상처리
                    int    nErrCode  = session.GetLastError();
                    string strErrMsg = session.GetErrorMessage(nErrCode);
                    // 연결 안됨 처리
                    LogBox.Items.Add("연결 에러");
                    LogBox.Items.Add("에러코드: [" + nErrCode + "] ");
                    LogBox.Items.Add(strErrMsg);
                }
            }
            else
            {
                // 연결처리가 된 상태이므로 패스
            }
        }
Exemplo n.º 3
0
        void AutoLogIn_Exec()
        {
            try
            {
                bool isConnect = false;
                if (rbExec.Checked)
                {
                    isConnect = myXASessionClass.ConnectServer("demo.etrade.co.kr", 20001);
                }
                else
                {
                    isConnect = myXASessionClass.ConnectServer("hts.etrade.co.kr", 20001);
                    //isConnect = myXASessionClass.ConnectServer("127.0.0.1", 20001);
                }

                if (!isConnect)
                {
                    //MessageBox.Show(myXASessionClass.GetLastError().ToString(), "SERVER ERROR");
                    LogWrite(LogType.ERROR, myXASessionClass.GetLastError().ToString());
                }

                // ETRADE 로그인

                bool isLoginOK = false;
                if (rbExec.Checked)
                {
                    isLoginOK = myXASessionClass.Login("kroad75w", "miji12!@", "miji1212!@", 0, false);
                }
                else
                {
                    isLoginOK = myXASessionClass.Login("kroad75", "miji12!@", "miji1212!@", 0, true);
                }
            }
            catch (Exception e)
            {
                EventLog.WriteEntry("OrderForm-AutoLogIn_Exec", e.ToString());
            }
        }
Exemplo n.º 4
0
        internal StartUp(XASessionClass session)
        {
            secret = new Secret();

            if (session.ConnectServer(secret.Server[1], secret.Port) && session.Login(secret.InfoToConnect[0], secret.InfoToConnect[1], secret.InfoToConnect[2], 0, true))
            {
                this.session = session;
                session._IXASessionEvents_Event_Login += OnEventConnect;
                session.Disconnect += OnReceiveDisconnect;
            }
            else
            {
            }
            InitializeComponent();
        }
Exemplo n.º 5
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (myXASessionClass.ConnectServer(서버명, 포트))
     {
         Console.WriteLine("ConnectServer 성공");
         if (myXASessionClass.Login(textBox1.Text, textBox2.Text, textBox3.Text, 0, false))
         {
             Console.WriteLine("Login 전송");
         }
         else
         {
         }
     }
     else
     {
     }
 }
Exemplo n.º 6
0
        bool LoginTo(LoginInfo user)
        {
            _ewh_LoginSync.Reset();

            bool result = _xingSession.Login(user.Id, user.Password, user.CertPassword, 0, false);

            if (result == false)
            {
                return(false);
            }

            while (true)
            {
                Application.DoEvents();
                if (_ewh_LoginSync.WaitOne(16) == true)
                {
                    break;
                }
            }

            return(_loggedIn);
        }
Exemplo n.º 7
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            bool isAliveServer = session.ConnectServer(AccountInfo.서버정보, AccountInfo.서버포트);

            LogWrite("IsAliveServer => " + isAliveServer.ToString());
            bool isSuccess = false;


            if (cbLogin.SelectedIndex == 0)
            {
                isSuccess = session.Login(
                    AccountInfoLEE.접속아이디
                    , AccountInfoLEE.접속비밀번호
                    , AccountInfoLEE.인증비밀번호
                    , (int)XA_SESSIONLib.XA_SERVER_TYPE.XA_REAL_SERVER
                    //, (int)XA_SESSIONLib.XA_SERVER_TYPE.XA_SIMUL_SERVER
                    , false);
                WorldFutureAccountInfo.LoginUser = "******";
            }
            else if (cbLogin.SelectedIndex == 1)
            {
                isSuccess = session.Login(
                    AccountInfoSON.접속아이디
                    , AccountInfoSON.접속비밀번호
                    , AccountInfoSON.인증비밀번호
                    , (int)XA_SESSIONLib.XA_SERVER_TYPE.XA_REAL_SERVER
                    //, (int)XA_SESSIONLib.XA_SERVER_TYPE.XA_SIMUL_SERVER
                    , false);
                WorldFutureAccountInfo.LoginUser = "******";
            }
            else if (cbLogin.SelectedIndex == 2)
            {
                isSuccess = session.Login(
                    AccountInfoJIN.접속아이디
                    , AccountInfoJIN.접속비밀번호
                    , AccountInfoJIN.인증비밀번호
                    //, (int)XA_SESSIONLib.XA_SERVER_TYPE.XA_REAL_SERVER
                    , (int)XA_SESSIONLib.XA_SERVER_TYPE.XA_SIMUL_SERVER
                    , false);
                WorldFutureAccountInfo.LoginUser = "******";
            }
            else if (cbLogin.SelectedIndex == 3)
            {
                isSuccess = session.Login(
                    AccountInfoJUNG.접속아이디
                    , AccountInfoJUNG.접속비밀번호
                    , AccountInfoJUNG.인증비밀번호
                    //, (int)XA_SESSIONLib.XA_SERVER_TYPE.XA_REAL_SERVER
                    , (int)XA_SESSIONLib.XA_SERVER_TYPE.XA_SIMUL_SERVER
                    , false);
                WorldFutureAccountInfo.LoginUser = "******";
            }

            if (isSuccess)
            {
                btnLogin.Enabled   = false;
                lblLogin.BackColor = isSuccess ? Color.Blue : Color.Black;
                LogWrite("IsConnectedServer => " + isSuccess.ToString());
                isLogoned        = true;
                btnClose.Enabled = true;

                InitializeTimer();
                timer1.Enabled = true;
                timer1.Start();
            }
        }
Exemplo n.º 8
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            bool isAliveServer = session.ConnectServer(AccountInfo.서버정보, AccountInfo.서버포트);

            LogWrite("IsAliveServer => " + isAliveServer.ToString());
            bool isSuccess = false;

            if (cbLogin.SelectedIndex == 0)
            {
                isSuccess = session.Login(
                    AccountInfoLEE.접속아이디
                    , AccountInfoLEE.접속비밀번호
                    , AccountInfoLEE.인증비밀번호
                    //, (int)XA_SESSIONLib.XA_SERVER_TYPE.XA_REAL_SERVER
                    , (int)XA_SESSIONLib.XA_SERVER_TYPE.XA_SIMUL_SERVER
                    , false);
                WorldFutureAccountInfo.LoginUser = "******";
            }
            else if (cbLogin.SelectedIndex == 1)
            {
                isSuccess = session.Login(
                    AccountInfoSON.접속아이디
                    , AccountInfoSON.접속비밀번호
                    , AccountInfoSON.인증비밀번호
                    //, (int)XA_SESSIONLib.XA_SERVER_TYPE.XA_REAL_SERVER
                    , (int)XA_SESSIONLib.XA_SERVER_TYPE.XA_SIMUL_SERVER
                    , false);
                WorldFutureAccountInfo.LoginUser = "******";
            }
            else if (cbLogin.SelectedIndex == 2)
            {
                isSuccess = session.Login(
                    AccountInfoJIN.접속아이디
                    , AccountInfoJIN.접속비밀번호
                    , AccountInfoJIN.인증비밀번호
                    //, (int)XA_SESSIONLib.XA_SERVER_TYPE.XA_REAL_SERVER
                    , (int)XA_SESSIONLib.XA_SERVER_TYPE.XA_SIMUL_SERVER
                    , false);
                WorldFutureAccountInfo.LoginUser = "******";
            }
            else if (cbLogin.SelectedIndex == 3)
            {
                isSuccess = session.Login(
                    AccountInfoJUNG.접속아이디
                    , AccountInfoJUNG.접속비밀번호
                    , AccountInfoJUNG.인증비밀번호
                    //, (int)XA_SESSIONLib.XA_SERVER_TYPE.XA_REAL_SERVER
                    , (int)XA_SESSIONLib.XA_SERVER_TYPE.XA_SIMUL_SERVER
                    , false);
                WorldFutureAccountInfo.LoginUser = "******";
            }

            if (isSuccess)
            {
                lblLogin.BackColor = isSuccess ? Color.Blue : Color.Black;
                LogWrite("IsConnectedServer => " + isSuccess.ToString());
                isLogoned        = true;
                btnClose.Enabled = true;

                InitializeTimer();

                try
                {
                    XingServerConfigData.IP   = ConfigurationManager.AppSettings["XingService_IP"];
                    XingServerConfigData.Port = Convert.ToInt32(ConfigurationManager.AppSettings["XingService_Port"]);
                    XingContext.Instance.StartServer();
                }
                catch (System.Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }

                timer1.Enabled = true;
                timer1.Start();
            }
        }