private void button2_Click(object sender, EventArgs e)
        {
            StringBuilder Result  = new StringBuilder(1024 * 1024);
            StringBuilder ErrInfo = new StringBuilder(256);

            #region 连接tdx服务器
            bool bool1         = TdxApi.OpenTdx(ErrInfo);
            int  ConnectionID  = TdxApi.TdxHq_Multi_Connect("222.73.49.4", 7709, Result, ErrInfo);
            int  ConnectionID2 = TdxApi.TdxHq_Multi_Connect("222.73.49.4", 7709, Result, ErrInfo);
            ALLlistCon.Add(ConnectionID);
            OverlistCon.Add(ConnectionID);
            #endregion

            int conSZ = OverlistCon[0];
            OverlistCon.RemoveAt(0);
            short Count = 0;
            //SZ 后台查询Count
            bool1 = TdxApi.TdxHq_Multi_GetSecurityCount(conSZ, 0, ref Count, ErrInfo);
            Dictionary <string, string> DicCon = new Dictionary <string, string>();
            DicCon.Add("Con", conSZ.ToString());
            DicCon.Add("Count", Count.ToString());

            //SZ 后台执行
            this.progressBarSZ.Maximum = Count;
            bk_GetStockInfoSZ.RunWorkerAsync(DicCon);



            ALLlistCon.Add(ConnectionID2);
            OverlistCon.Add(ConnectionID2);

            int conSH = OverlistCon[0];
            OverlistCon.RemoveAt(0);
            //SH 后台查询Count
            bool1 = TdxApi.TdxHq_Multi_GetSecurityCount(conSH, 1, ref Count, ErrInfo);
            Dictionary <string, string> DicConSH = new Dictionary <string, string>();
            DicConSH.Add("Con", conSH.ToString());
            DicConSH.Add("Count", Count.ToString());

            //SZ 后台执行
            this.progressBarSH.Maximum = Count;
            bk_GetStockInfoSH.RunWorkerAsync(DicConSH);

            DownStockInfo.Enabled = false;
        }
        private void Get5MinTimer_Tick(object sender, EventArgs e)
        {
            DateTime startTime = Convert.ToDateTime("9:00");
            DateTime endTime   = Convert.ToDateTime("15:00");

            if (!IsDownStockCode)
            {
                StringBuilder Result  = new StringBuilder(1024 * 1024);
                StringBuilder ErrInfo = new StringBuilder(256);

                #region 连接tdx服务器
                bool bool1         = TdxApi.OpenTdx(ErrInfo);
                int  ConnectionID  = TdxApi.TdxHq_Multi_Connect("222.73.49.4", 7709, Result, ErrInfo);
                int  ConnectionID2 = TdxApi.TdxHq_Multi_Connect("222.73.49.4", 7709, Result, ErrInfo);
                ALLlistCon.Add(ConnectionID);
                OverlistCon.Add(ConnectionID);
                #endregion

                int conSZ = OverlistCon[0];
                OverlistCon.RemoveAt(0);
                short Count = 0;
                //SZ 后台查询Count
                bool1 = TdxApi.TdxHq_Multi_GetSecurityCount(conSZ, 0, ref Count, ErrInfo);
                Dictionary <string, string> DicCon = new Dictionary <string, string>();
                DicCon.Add("Con", conSZ.ToString());
                DicCon.Add("Count", Count.ToString());

                //SZ 后台执行
                this.progressBarSZ.Maximum = Count;
                bk_GetStockInfoSZ.RunWorkerAsync(DicCon);



                ALLlistCon.Add(ConnectionID2);
                OverlistCon.Add(ConnectionID2);

                int conSH = OverlistCon[0];
                OverlistCon.RemoveAt(0);
                //SH 后台查询Count
                bool1 = TdxApi.TdxHq_Multi_GetSecurityCount(conSH, 1, ref Count, ErrInfo);
                Dictionary <string, string> DicConSH = new Dictionary <string, string>();
                DicConSH.Add("Con", conSH.ToString());
                DicConSH.Add("Count", Count.ToString());

                //SZ 后台执行
                this.progressBarSH.Maximum = Count;
                bk_GetStockInfoSH.RunWorkerAsync(DicConSH);
            }
            else if (ShStockCompleted && SzStockCompleted)
            {
                if (DateTime.Compare(DateTime.Now, startTime) > 0 && DateTime.Compare(DateTime.Now, endTime) < 0)
                {
                    if (DateTime.Now.ToString("mm").Substring(1, 1) == "5" || DateTime.Now.ToString("mm").Substring(1, 1) == "0")
                    {
                        if (!IsSz5MinWork)
                        {
                            bk_GetStock5MinInfoSZ.RunWorkerAsync();
                        }
                        if (!IsSh5MinWork)
                        {
                            bk_GetStock5MinInfoSH.RunWorkerAsync();
                        }
                    }
                }
                if (DateTime.Compare(DateTime.Now, endTime) > 0 && !FinanceWorkCompleted && !IsFinanceWork)
                {
                    bk_FinanceInfo.RunWorkerAsync();
                }
            }
        }