Beispiel #1
0
 private void button_Click(object sender, RoutedEventArgs e)
 {
     if (sender == m_btnDisconnect)
     {
         api_.Dispose();
         api_ = null;
         CreateKiwoomApi();
         button.IsEnabled          = true;
         m_btnDisconnect.IsEnabled = false;
     }
     else if (sender == button)
     {
         if (!api_.IsConnected)
         {
             api_.Connect();
         }
     }
     else if (sender == m_btnRequestCondition)
     {
         if (!api_.IsConnected)
         {
             MessageBox.Show("접속상태가 아닙니다.");
             return;
         }
         RefreshSearchConditionCombobox(ref m_cbSearchCondition);
     }
 }
Beispiel #2
0
 /// <summary>
 /// 키움API객체 생성
 /// </summary>
 private void CreateKiwoomApi()
 {
     api_                       = new Kiwoom.Api();
     api_.OnConnected          += api__OnConnected;
     api_.OnConnectError       += api__OnConnectError;
     api_.OnReceiveTrCondition += api__OnReceiveTrCondition;
     api_.OnReceiveTrData      += Api__OnReceiveTrData;
 }
Beispiel #3
0
        private void api__OnConnected(Kiwoom.Api sender)
        {
            m_btnDisconnect.IsEnabled = true;
            button.IsEnabled          = false;

            m_tbLog.Text  = "연결되었습니다!\n";
            m_tbLog.Text += "사용자ID=" + api_.UserID + "\n";
            m_tbLog.Text += "사용자명=" + api_.UserName + "\n";
            m_tbLog.Text += "계좌목록\n";

            string[] accList = api_.Accounts;
            foreach (string acc in accList)
            {
                m_tbLog.Text += acc + "\n";
            }
        }
Beispiel #4
0
        private void M_ctrl_OnConnected(Kiwoom.Api sender)
        {
            m_btnDisconnect.IsEnabled = true;
            button.IsEnabled          = false;

            m_tbLog.Text  = "연결되었습니다!\n";
            m_tbLog.Text += "사용자ID=" + m_ctrl.UserID + "\n";
            m_tbLog.Text += "사용자명=" + m_ctrl.UserName + "\n";
            m_tbLog.Text += "계좌목록\n";

            string[] accList = m_ctrl.Accounts;
            foreach (string acc in accList)
            {
                m_tbLog.Text += acc + "\n";
            }

            RefreshSearchConditionCombobox(ref m_cbSearchCondition);
        }
Beispiel #5
0
        public MainWindow()
        {
            InitializeComponent();
            Log.Init();

            log = Log.Get(this.GetType());
            log.Debug("Start...");

            // 키움API객체 생성
            m_ctrl                       = new Kiwoom.Api();
            m_ctrl.OnConnected          += M_ctrl_OnConnected;
            m_ctrl.OnReceiveTrCondition += M_ctrl_OnReceiveTrCondition;

            // 그리드 생성
            DataGridTextColumn col = new DataGridTextColumn();

            col.Binding = new Binding("code");
            col.Header  = "종목코드";

            //m_grid.Columns.Add(col);
        }