using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace TradeObjTest
{
    public partial class Form2 : Form
    {
        Form1 m_DlgForm1;
        public Form2()
        {
            InitializeComponent();
        }

        public void SetParent(Form1 pForm1)
        {
            m_DlgForm1 = pForm1;
        }

        public void AddAccount(string strAccount)
        {
            ALLAccount.Items.Add(strAccount);

            if(ALLAccount.Items.Count > 0)
                ALLAccount.SelectedIndex = 0;
        }

        public void SetAccountIndex(string strAccount)
        {
            for (int i = 0; i < ALLAccount.Items.Count; i++)
            {
                if (ALLAccount.Items[i].ToString().CompareTo(strAccount) == 0)
                {
                    ALLAccount.SelectedIndex = i;
                    return;
                }
            }
        }

        public void SetQueryData(string strQueryData)
        { 
            
        }

        private void QueryButton_Click(object sender, EventArgs e)
        {
            if (txtAPI.Text.Length <= 0)
            {
                MessageBox.Show("輸入API");
                return;
            }

            string[] arArgs = ALLAccount.Text.Split('|');
            if (arArgs.Length > 1)
            {
                //m_DlgForm1.MIXQuery(arArgs[1], txtAPI.Text, txtParam.Text);
            }
            else
            {
                MessageBox.Show("輸入帳號");
            }
        }

        private void btnClose_Click(object sender, EventArgs e)
        {
            this.Hide();
        }
    }
}
