Example #1
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            SqLiteHelper sqlHelper = new SqLiteHelper();

            sqlHelper.SqliteOpen();
            try
            {
                //查询所有可以交易品种
                symbols = SYRequest.QureyAllSymbol();
                if (symbols == null)
                {
                    MessageBox.Show("查询当前可用交易品种失败!");
                    windowStop = true;
                    Close();
                    return;
                }

                //读取整张表
                SQLiteDataReader reader = sqlHelper.ReadFullTable("user");
                if (reader != null)
                {
                    List <string> item = new List <string>();
                    while (reader.Read())
                    {
                        int    id         = reader.GetInt32(reader.GetOrdinal("id"));
                        string username   = reader.GetString(reader.GetOrdinal("username"));
                        string password   = reader.GetString(reader.GetOrdinal("password"));
                        int    uid        = reader.GetInt32(reader.GetOrdinal("uid"));
                        string coinSymbol = reader.GetString(reader.GetOrdinal("coinSymbol"));
                        string reamrks    = reader.GetString(reader.GetOrdinal("remarks"));

                        ListViewItem lvt = new ListViewItem();
                        lvt.Text = id + "";
                        lvt.SubItems.Add(username);
                        lvt.SubItems.Add("********");
                        lvt.SubItems.Add(uid + "");
                        lvt.SubItems.Add(coinSymbol);
                        lvt.SubItems.Add(getRunStatus(uid).ToString());
                        lvt.SubItems.Add(reamrks);
                        strategyList.Items.Add(lvt);
                    }
                }
                sqlHelper.SqliteClose();

                //设置顶时任务
                System.Timers.Timer timer = new System.Timers.Timer();
                timer.Enabled  = true;
                timer.Interval = 10000;//执行间隔时间,单位为毫秒
                timer.Start();
                timer.Elapsed += new System.Timers.ElapsedEventHandler(OnTimer);
            }
            catch
            {
                sqlHelper.SqliteClose();
            }
        }
Example #2
0
        private void btn_Flush_Click(object sender, EventArgs e)
        {
            try
            {
                //查询所有可以交易品种
                symbols = SYRequest.QureyAllSymbol();
                if (symbols == null)
                {
                    MessageBox.Show("刷新失败!");
                    return;
                }

                SqLiteHelper sqlHelper = new SqLiteHelper();
                strategyList.Items.Clear();
                sqlHelper.SqliteOpen();
                //读取整张表
                SQLiteDataReader reader = sqlHelper.ReadFullTable("user");
                if (reader != null)
                {
                    List <string> item = new List <string>();
                    while (reader.Read())
                    {
                        int    id         = reader.GetInt32(reader.GetOrdinal("id"));
                        string username   = reader.GetString(reader.GetOrdinal("username"));
                        string password   = reader.GetString(reader.GetOrdinal("password"));
                        int    uid        = reader.GetInt32(reader.GetOrdinal("uid"));
                        string coinSymbol = reader.GetString(reader.GetOrdinal("coinSymbol"));
                        string reamrks    = reader.GetString(reader.GetOrdinal("remarks"));

                        ListViewItem lvt = new ListViewItem();
                        lvt.Text = id + "";
                        lvt.SubItems.Add(username);
                        lvt.SubItems.Add("********");
                        lvt.SubItems.Add(uid + "");
                        lvt.SubItems.Add(coinSymbol);
                        lvt.SubItems.Add(getRunStatus(uid).ToString());
                        lvt.SubItems.Add(reamrks);
                        strategyList.Items.Add(lvt);
                    }
                }
                sqlHelper.SqliteClose();
                MessageBox.Show("刷新成功!");
            }
            catch
            {
                MessageBox.Show("刷新失败!");
            }
        }