Exemple #1
0
        /// <summary>
        /// 输出进度条委托信息
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OutPutTaskProgressBarDelegate(object sender, MainEvents.OutPutTaskProgressBarEventArgs e)
        {
            int TaskIndex = e.TaskIndex;
            int ProgressNum, RecordNum;

            ProgressNum = e.ProgressNum;
            RecordNum   = e.RecordNum;
            double fPerNum = double.Parse(ProgressNum.ToString()) / double.Parse(RecordNum.ToString());
            double perNumF = double.Parse(fPerNum.ToString("f2")) * 100;
            int    perNum  = Convert.ToInt32(perNumF);

            this.dataGridView_TaskList.Rows[TaskIndex].Cells["ProgressBar"].Value = perNum;
        }
        public async Task GetTransactionInfo(HttpClient client)
        {
            try
            {
                #region 获取消费记录

                HttpRequestMessage           request    = new HttpRequestMessage(HttpMethod.Post, new Uri("https://cwss.bjut.edu.cn:9090/smart_web/ajax/tran/list.json"));
                IDictionary <string, string> parameters = new Dictionary <string, string>();
                parameters.Add("int_start", "0");
                parameters.Add("int_maxSize", RecordNum.ToString());
                request.Content = new HttpFormUrlEncodedContent(parameters);
                HttpResponseMessage response = await client.SendRequestAsync(request);

                string jsonStr = await response.Content.ReadAsStringAsync();

                PraseTransactionInfo(jsonStr);
                #endregion
            }
            catch { };
        }