Пример #1
0
        private void btnGetUpdate_Click(object sender, EventArgs e)
        {
            TF.YA.Soft.DBSyncObject     uStore      = new TF.YA.Soft.DBSyncObject(strStoreConn);
            List <TF.YA.Soft.UserIndex> userIndexes = new List <TF.YA.Soft.UserIndex>();

            if (!uStore.GetUserIndex(tbUserID.Text, tb_UserObjectName.Text, userIndexes))
            {
                MessageBox.Show("当前客户端未注册此更新对象");
                return;
            }
            tbUpdateLog.Text = "";

            tbUpdateLog.AppendText(string.Format("本次共获得{0}条更新" + "\r\n", userIndexes.Count));
            progressBar1.Maximum = userIndexes.Count;
            progressBar1.Value   = 0;//设置当前值
            foreach (var item in userIndexes)
            {
                tbUpdateLog.AppendText(string.Format("开始下载{0}" + "\r\n", item.Key));
                TF.YA.Soft.SyncData d = new TF.YA.Soft.SyncData();
                uStore.GetObjectData(tb_UserObjectName.Text, item.Key, d);
                tbUpdateLog.AppendText(string.Format("成功获取{0}的值:{1}" + "\r\n", item.Key, d.Json));

                uStore.CommitUserIndex(tbUserID.Text, tb_UserObjectName.Text, item.Key);
                tbUpdateLog.AppendText(string.Format("成功提交{0}" + "\r\n", item.Key));
                progressBar1.Value += 1;
            }
        }
Пример #2
0
        private void button1_Click_1(object sender, EventArgs e)
        {
            TF.YA.Soft.DBSyncObject      uStore      = new TF.YA.Soft.DBSyncObject(strStoreConn);
            List <TF.YA.Soft.SyncDataOP> userIndexes = new List <TF.YA.Soft.SyncDataOP>();

            uStore.GetObjectDatas(tb_UserObjectName.Text, userIndexes);

            tbUpdateLog.Text = "";

            tbUpdateLog.AppendText(string.Format("本次共获得{0}条更新" + "\r\n", userIndexes.Count));
            progressBar1.Maximum = userIndexes.Count;
            progressBar1.Value   = 0;//设置当前值
            foreach (var item in userIndexes)
            {
                tbUpdateLog.AppendText(string.Format("开始下载{0}" + "\r\n", item.Key));
                TF.YA.Soft.SyncData d = new TF.YA.Soft.SyncData();
                uStore.GetObjectData(tb_UserObjectName.Text, item.Key, d);
                tbUpdateLog.AppendText(string.Format("成功获取{0}的值:{1}" + "\r\n", item.Key, d.Json));

                uStore.CommitUserIndex(tbUserID.Text, tb_UserObjectName.Text, item.Key);
                tbUpdateLog.AppendText(string.Format("成功提交{0}" + "\r\n", item.Key));
                progressBar1.Value += 1;
            }
        }