Exemple #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            StringBuilder Result  = new StringBuilder(1024 * 1024);
            StringBuilder ErrInfo = new StringBuilder(256);

            bool bool1 = TdxApi.OpenTdx(ErrInfo);

            if (bool1)
            {
                BackGroundForm form = new BackGroundForm();
                form.Show();
            }
        }
Exemple #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            StringBuilder Result  = new StringBuilder(1024 * 1024);
            StringBuilder ErrInfo = new StringBuilder(256);
            bool          bool1   = TdxApi.OpenTdx(ErrInfo);

            int ConnectionID = TdxApi.TdxHq_Multi_Connect("222.73.49.4", 7709, Result, ErrInfo);

            bool1 = TdxApi.TdxHq_Multi_GetCompanyInfoCategory(ConnectionID, 0, "000001", Result, ErrInfo);
            Console.WriteLine(bool1 ? Result.ToString() : ErrInfo.ToString());
            int length = 10000;

            bool1 = TdxApi.TdxHq_Multi_GetCompanyInfoContent(ConnectionID, 0, "000001", "000001.txt", 0, 12665, Result, ErrInfo);
            Console.WriteLine(bool1 ? Result.ToString() : ErrInfo.ToString());
        }
        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;
        }
Exemple #4
0
        public MainWindow()
        {
            var logon = new Logon();

            logon.ShowDialog();

            if (!Logon.IsLogon)
            {
                this.Close();
                return;
            }

            InitializeComponent();
            this.Loaded += (s, e) =>
            {
                //var client = new ServiceReference.DataWebServiceSoapClient();
                //var isLoginSuccess = client.CompareToolLogin("W7txy", "W5waD6Kk");
                //if (isLoginSuccess)
                //{
                //    CommonUtils.UserName = "******";
                //}
                //else
                //{
                //    MessageBox.Show("连接失败,未能自动登录!");
                //}

                tiEncrypt.Visibility     = System.Windows.Visibility.Visible;
                tiGroupManage.Visibility = System.Windows.Visibility.Visible;
                tiInterface.Visibility   = System.Windows.Visibility.Visible;

                this.Title += CommonUtils.Version;

                importTool.OnDBChangeComplete += new Action(RefreshComparePage);

                groupTool.OnGroupChanged += new Action(() => { exportTool.Init(); });
            };
            TdxApi.OpenTdx();
        }
        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();
                }
            }
        }