コード例 #1
0
        /// <summary>
        ///下载历史数据
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void getstockdatabt_Click(object sender, EventArgs e)
        {
            GeneralClass gc = new GeneralClass();

            statusl.Text = "Download " + AdvStock.mystock + "……";
            string stkcode = AdvStock.mystock;
            if (!gc.downloadstockdata(stkcode))
                statusl.Text = "Download " + AdvStock.mystock + ".csv" + " Failed";
            else
                statusl.Text = "Download " + AdvStock.mystock + ".csv" + " Successed";
        }
コード例 #2
0
        /// <summary>
        ///下载历史数据
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void getstockdatabt_Click(object sender, EventArgs e)
        {
            GeneralClass gc = new GeneralClass();

            statusl.Text = "Download " + AdvStock.mystock + "……";
            string stkcode = AdvStock.mystock;

            if (!gc.downloadstockdata(stkcode))
            {
                statusl.Text = "Download " + AdvStock.mystock + ".csv" + " Failed";
            }
            else
            {
                statusl.Text = "Download " + AdvStock.mystock + ".csv" + " Successed";
            }
        }
コード例 #3
0
        /// <summary>
        /// 下载历史数据
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void bt_dlstockdata_Click(object sender, EventArgs e)
        {
            GeneralClass gc = new GeneralClass();

            lb_syssem.Items.Clear();

            int iTotal   = 0;
            int iSuccess = 0;
            int nthread  = CfgStruct.lns.Count;

            Thread[] tds = new Thread[nthread];
            string[] msg = new string[nthread + 1];

            foreach (string stkcode in CfgStruct.lns)
            {
                gc.Stkcode  = stkcode;
                tds[iTotal] = new Thread(new ThreadStart(delegate()
                {
                    gc.downloadstockdata(msg[iTotal]);
                }));
                ++iTotal;
            }
            foreach (Thread t in tds)
            {
                t.Start();
                ++iSuccess;
            }

            lbstatusdl.Text = iSuccess.ToString();
            //    if (!gc.downloadstockdata(stkcode))
            //    {
            //        //提示
            //        msg = stkcode + "下载失败。";
            //        ++iSuccess;
            //    }
            //    else
            //        msg = stkcode + "下载成功。";

            //    lb_syssem.Items.Add(msg);
            //    ++iTotal;
            //}
            //msg = "处理" + iTotal.ToString() + "," + "成功" + iSuccess.ToString() + "," + "失败" + (iTotal - iSuccess).ToString();
            string msgs = "下载线程启动";

            lb_syssem.Items.Add(msgs);
        }
コード例 #4
0
ファイル: MainForm.cs プロジェクト: godsonhyl/MarketInfo
        /// <summary>
        /// 下载历史数据
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void bt_dlstockdata_Click(object sender, EventArgs e)
        {
            GeneralClass gc = new GeneralClass();
            lb_syssem.Items.Clear();

            int iTotal = 0;
            int iSuccess = 0;
            int nthread = CfgStruct.lns.Count;
            Thread[] tds = new Thread[nthread];
            string[] msg = new string[nthread + 1];

            foreach (string stkcode in CfgStruct.lns)
            {
                gc.Stkcode = stkcode;
                tds[iTotal] = new Thread(new ThreadStart(delegate ()
                {
                    gc.downloadstockdata(msg[iTotal]);
                }));
                ++iTotal;
            }
            foreach (Thread t in tds)
            {
                t.Start();
                ++iSuccess;
            }

            lbstatusdl.Text = iSuccess.ToString();
            //    if (!gc.downloadstockdata(stkcode))
            //    {
            //        //提示
            //        msg = stkcode + "下载失败。";
            //        ++iSuccess;
            //    }
            //    else
            //        msg = stkcode + "下载成功。";

            //    lb_syssem.Items.Add(msg);
            //    ++iTotal;
            //}
            //msg = "处理" + iTotal.ToString() + "," + "成功" + iSuccess.ToString() + "," + "失败" + (iTotal - iSuccess).ToString();
            string msgs = "下载线程启动";
            lb_syssem.Items.Add(msgs);
        }