public void UpdateProgressBar(int ipos) { if (this.InvokeRequired) { SetPos setpos = new SetPos(UpdateProgressBar); this.Invoke(setpos, new object[] { ipos }); } else { // update value this.progressBar1.Value = Convert.ToInt32(ipos); // show status if (this.progressBar1.Value < this.progressBar1.Maximum) { this.labelStatus.Text = this.progressBar1.Value.ToString() + "/" + this.progressBar1.Maximum.ToString(); } else { this.labelStatus.Text = "Done!"; this.btnStatus.BackColor = Color.Green; } } }
public static DataTable B(string f, decimal SN, string k, SetPos s) { string Message = ""; var dt = new DataTable(); dt.Columns.Add("身份证号", System.Type.GetType("System.String")); dt.Columns.Add("报名序号", System.Type.GetType("System.String")); dt.Columns.Add("教育年份", System.Type.GetType("System.String")); dt.Columns.Add("手机", System.Type.GetType("System.String")); dt.Columns.Add("状态"); string SQL = "select * from [sheet1$]"; var dataSet = E.ExcuteDataset(f, SQL); DataTable dt2 = dataSet.Tables[0]; int Max = dt2.Rows.Count; for (int i = 0; i < dt2.Rows.Count; i++) { try { var dr = dt2.Rows[i]; Message = string.Format("正在处理:{0}",dr["报名序号"].ToString()); s(i, Max, false, Message, dt); if (dr["身份证号"] != DBNull.Value && dr["报名序号"] != DBNull.Value) { var m = new SR.M1(); m.IDCard = dr["身份证号"].ToString(); m.IDSN = dr["报名序号"].ToString(); m.Year = Convert.ToInt32(dr["教育年份"].ToString()); m.sType = string.Empty; m.Phone = dr["手机"].ToString(); m.Name = string.Empty; m.SN = SN; m.Type = 1; var r1 = I.S(m, k); var row = dt.NewRow(); row["身份证号"] = dr["身份证号"].ToString().Trim(); row["报名序号"] = dr["报名序号"].ToString().Trim(); row["教育年份"] = dr["教育年份"].ToString().Trim(); row["手机"] = dr["手机"].ToString().Trim(); row["状态"] = U.N2S(r1.Code); dt.Rows.Add(row); if (r1.Code != 0) { log.Info("{0},{1}", r1.Code, r1.Message); } } Thread.Sleep(300); } catch (Exception ex1) { log.Info("{0},{1}", ex1.Message, ex1.StackTrace); } } Message = "完成"; s(Max, Max, true, Message, dt); return dt; }
private delegate void SetPos(String com); //代理 private void SetTextMesssage(String com) // 进度条值更新函数(参数必须跟声明的代理参数一样) { if (this.InvokeRequired) { SetPos setpos = new SetPos(SetTextMesssage); // 需要代理的函数名 this.Invoke(setpos, new object[] { com }); } else { // lock必须锁定一个object if (com == "read_bar") { lock ((object)this.progreassbar_num) { this.textBox1.Text = this.progreassbar_num + "/" + this.all_images_group.Count; this.progressBar1.Value = Convert.ToInt32(100 * this.progreassbar_num / this.all_images_group.Count); } } else if (com == "compare_bar") { lock ((object)this.progreassbar_num) { int total_num = this.iho_group.Count * (this.iho_group.Count - 1) / 2; this.textBox3.Text = this.progreassbar_num + "/" + total_num; this.progressBar2.Value = Convert.ToInt32(100 * this.progreassbar_num / total_num); } } } }
public void visit(SetPos setPos) { setPos.expression1.accept(this); setPos.expression2.accept(this); #if (UNCOMMENT) Turtle.MoveTo(setPos.expression1.output, setPos.expression2.output); #endif }
/// <summary> /// 输出日志信息 /// </summary> /// <param name="ipos"></param> /// <param name="vinfo"></param> private void SetTextMesssage(int ipos, string vinfo) { if (this.InvokeRequired) { SetPos setpos = new SetPos(SetTextMesssage); this.Invoke(setpos, new object[] { ipos, vinfo }); } else { this.txtLog.AppendText(vinfo); } }
private void SetTextMessage_rawfile_num(int ipos_rawfile_num) { if (this.InvokeRequired) { SetPos setpos = new SetPos(SetTextMessage_rawfile_num); this.Invoke(setpos, new object[] { ipos_rawfile_num }); } else { this.rawfilenum.Text = "A:" + ipos_rawfile_num.ToString() + "/" + pathway.Items.Count.ToString(); } }
private delegate void SetPos(int ipos, string vinfo);//代理 private void SetTextMesssage(int ipos, string vinfo) { if (this.InvokeRequired) { SetPos setpos = new SetPos(SetTextMesssage); this.Invoke(setpos, new object[] { ipos, vinfo }); } else { this.progressBar1.Value = Convert.ToInt32(ipos); } }
private delegate void SetPos(int i, int j);//定义一个引用函数 private void method2(int i, int j) { if (this.InvokeRequired) //判断是否为需要invoke方法调用,检测调用是否为非本线程控件。 { SetPos setpos = new SetPos(method2); //将setpos实例化,并且将method2方法添加到setpod上。 this.Invoke(setpos, new object[] { i, j }); //执行setpos中的方法 } else { this.progressBar1.Value = i; } }
private void SetProgressValue(int ipos) { if (this.InvokeRequired) { SetPos setPos = new SetPos(SetProgressValue); this.Invoke(setPos, new object[] { ipos }); } else { this.progressBar.Value = Convert.ToInt32(ipos); } }
private void SetTextMessage(int ipos) { if (this.InvokeRequired) { SetPos setpos = new SetPos(SetTextMessage); this.Invoke(setpos, new object[] { ipos }); } else { this.prbCharge.Value = Convert.ToInt32(ipos); } }
// 开始进度条 private void updateProgressBar(long currentvalue) { if (this.InvokeRequired) { SetPos setpos = new SetPos(updateProgressBar); this.Invoke(setpos, new object[] { currentvalue }); } else { this.progressBar.Value = Convert.ToInt32(currentvalue); } }
/// <summary> /// 输出信息 /// </summary> /// <param name="msg"></param> private void SetTextMesssage(string msg) { if (this.InvokeRequired) { SetPos setpos = new SetPos(SetTextMesssage); this.Invoke(setpos, new object[] { msg }); } else { this.txtLog.AppendText(string.Format("[{0}]{1}\r\n", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), msg)); } }
private void SetTextMesssage(int ipos, int iTotal, string strMessage) { if (this.InvokeRequired) { SetPos setpos = new SetPos(SetTextMesssage); this.Invoke(setpos, new object[] { ipos, iTotal, strMessage }); } else { this.lb_status.Text = "已完成" + ipos + "/" + iTotal + " " + strMessage; this.pb_createFile.Value = Convert.ToInt32(ipos * 100 / iTotal); } }
public void SetMaxValueOfProgressBar(int ipos) { if (this.InvokeRequired) { SetPos setpos = new SetPos(SetMaxValueOfProgressBar); this.Invoke(setpos, new object[] { ipos }); } else { this.progressBar1.Maximum = Convert.ToInt32(ipos); this.btnStatus.BackColor = Color.Red; } }
private void SetTextMessage(int ipos) { if (this.InvokeRequired) { SetPos setpos = new SetPos(SetTextMessage); this.Invoke(setpos, new object[] { ipos }); } else { this.label1.Text = ipos.ToString() + "/100"; this.progressBar1.Value = Convert.ToInt32(ipos); } }
//更新进度条 private void send_messsage() { if (this.InvokeRequired)//判断是否是控件所在线程外的线程需调用本控件 { SetPos setpos = new SetPos(send_messsage); this.Invoke(setpos); } else { progressBar1.Value++; label3.Text = "已完成" + progressBar1.Value.ToString() + "/" + progressBar1.Maximum.ToString() + ":"; } }
private void SetTextMessage(int ipos) { if (this.InvokeRequired) { SetPos setpos = new SetPos(SetTextMessage); this.Invoke(setpos, new object[] { ipos }); } else { this.label7.Text = ipos.ToString() + "%"; this.progressBar1.Value = Convert.ToInt32(ipos); } }
/// <summary> /// 显示日志信息 /// </summary> /// <param name="ipos"></param> /// <param name="vinfo"></param> private void SetLogText(int ipos, string vinfo) { if (this.InvokeRequired) { SetPos setpos = new SetPos(SetLogText); this.Invoke(setpos, new object[] { ipos, vinfo }); } else { this.labLog.ForeColor = Color.Green; this.labLog.Text = vinfo; } }
private void SetTextMesssage(int ipos, string vinfo) { if (this.InvokeRequired) { SetPos setpos = new SetPos(SetTextMesssage); this.Invoke(setpos, new object[] { ipos, vinfo }); } else { this.lblUploadProcess.Text = ipos.ToString() + "/1000"; this.progressBarUpload.Value = Convert.ToInt32(ipos); this.textBox1.AppendText(vinfo); } }
private delegate void SetPos(int ipos, string vinfo); //代理 private void SetTextMesssage(int ipos, string vinfo) //进度条值更新函数(参数必须跟声明的代理参数一样) { if (this.InvokeRequired) { SetPos setpos = new SetPos(SetTextMesssage); this.Invoke(setpos, new object[] { ipos, vinfo }); } else { this.label1.Text = ipos.ToString() + "/1000"; this.progressBar1.Value = Convert.ToInt32(ipos); this.richTextBox1.AppendText(vinfo); } }
private void SetTextMessage(int ipos, int total) { if (this.InvokeRequired) { SetPos setpos = new SetPos(SetTextMessage); this.Invoke(setpos, new object[] { ipos, total }); } else { this.lblMsg.Text = ipos.ToString() + " / " + total.ToString();// ipos.ToString() + " %"; this.progressBar1.Value = Convert.ToInt32(ipos * 100 / total); } }
//设置进度条 private void SetProgress(int ipos) { if (this.InvokeRequired) { SetPos setpos = new SetPos(SetProgress); this.Invoke(setpos, new object[] { ipos }); } else { this.progressBar1.Value = Convert.ToInt32(ipos); //this.skinLabel2.Text = (ipos / (this.progressBar1.Maximum)).ToString("P"); } }
///代理 /// <summary> /// 进度条 /// </summary> /// <param name="ipos"></param> private void SetProgressBar(int ipos) { if (progressBar1.InvokeRequired) { SetPos setpos = new SetPos(SetProgressBar); this.Invoke(setpos, new object[] { ipos }); } else { this.progressBar1.Value = Convert.ToInt32(ipos); if (ipos == 100) { this.progressBar1.Visible = false; } } }
public void SetTextMessage(int ipos) { if (this.InvokeRequired) { SetPos setpos = new SetPos(SetTextMessage); this.Invoke(setpos, new object[] { ipos }); } else { //this.label1.Text = ipos.ToString() + "/100"; this.progressBar1.Value = Convert.ToInt32(ipos); //this.progressBar1.Value++; //Log.Debug("ipos = " + this.progressBar1.Value); } }
private void SetTextMessage(int ipos) { if (this.InvokeRequired) { SetPos setpos = new SetPos(SetTextMessage); this.Invoke(setpos, new object[] { ipos }); } else { this.toolStripStatusLabel1.Text = ipos.ToString() + "/100"; this.ProgressBar.Value = Convert.ToInt32(ipos); } if (ipos == 100) { this.toolStripStatusLabel1.Text = "加载完成"; } }
private void SetTextMessage() { if (this.InvokeRequired) { SetPos setpos = new SetPos(SetTextMessage); this.Invoke(setpos, new object[] { }); } else { this.label3.Text = "进度:" + now.ToString() + "/" + total.ToString(); if (now > this.progressBar1.Maximum) { now = this.progressBar1.Maximum; } this.progressBar1.Value = now; } }
/// <summary> /// 进度条值更新函数(参数必须跟声明的代理参数一样) /// </summary> /// <param name="ipos"></param> /// <param name="vinfo"></param> private void SetPbPos(int ipos) { if (this.InvokeRequired) { SetPos setPos = new SetPos(SetPbPos); this.Invoke(setPos, new object[] { ipos }); } else { this.Pb.Value = Pb.Value + ipos; if (Pb.Value == Emps.Count) { MessageBox.Show("写入完成!"); this.Pb.Value = 0; setEnabled(true); } } }
private void SetTextMessage(int ipos) { if (this.InvokeRequired) { SetPos setpos = new SetPos(SetTextMessage); this.Invoke(setpos, new object[] { ipos }); } else { this.progressBar1.Value = Convert.ToInt32(ipos); if (ipos == 100) { Tips.Text = ("解析完成"); button4.Enabled = true; OpenBT.Enabled = true; } } }
private void SetTextMessage(int ipos, string info) { if (this.InvokeRequired) { SetPos setpos = new SetPos(SetTextMessage); this.Invoke(setpos, new object[] { ipos, info }); } else { this.progressBar1.Value = Convert.ToInt32(ipos); label2.Text = info; if (ipos == 100) { this.button1.Enabled = true; this.checkBox1.Enabled = true; this.CB_size.Enabled = true; //this.listBox1.Items.Clear(); } } }
private void Awake() { Instance = this; }
private void SetMesssage(int ipos) { if (this.InvokeRequired) { SetPos setpos = new SetPos(SetMesssage); this.Invoke(setpos, new object[] { ipos }); } else { this.progressBar1.Value = Convert.ToInt32(ipos); if (this.progressBar1.Value >= 100) { if (MessageBox.Show("切割完成") == DialogResult.OK) { this.progressBar1.Value = 0; } } } }
private void SetTextMessage(int Value, int Maximum, bool Finish, string Message, DataTable dt) { if (this.InvokeRequired) { SetPos setpos = new SetPos(SetTextMessage); this.Invoke(setpos, new object[] { Value, Maximum, Finish, Message, dt }); } else { this.panel1.Show(); this.EnabledBtn(false); this.label1.Text = string.Format("{0}/{1}", Value, Maximum); this.label2.Text = Message; this.progressBar1.Value = Value; this.progressBar1.Maximum = Maximum; if (Finish) { dataGridView1.DataSource = dt; this.panel1.Hide(); this.EnabledBtn(true); } } }
private void SetTextMesssage(int ipos, string vinfo) { if (this.InvokeRequired) { switch (ipos) { case 0: visitApi("StartAppraisal?AppraisalName=" + StartAppraisal.AppraisalType); break; case 1: //生成cardoutlin DataTable DTCL_CardList = StartAppraisal.DT_CardListTable; string CL_cardName = ""; string CL_cardCode = ""; int CL_cardItemCount = 0; for (int i = 0; i < DTCL_CardList.Rows.Count; i++) { CL_cardName = DTCL_CardList.Rows[i]["cardName"].ToString(); CL_cardCode = DTCL_CardList.Rows[i]["cardCode"].ToString(); CL_cardItemCount = int.Parse(DTCL_CardList.Rows[i]["cardItemCount"].ToString()); visitApi("SetCardList?cardName=" + CL_cardName + "&cardCode=" + CL_cardCode + "&cardItemCount=" + CL_cardItemCount + "&entrance=" + StartAppraisal.AppraisalType); } break; case 2: DataTable DTCC_CardContent = StartSetCardContent.DT_CardContent; string CC_cardCode = ""; string CC_item = ""; string CC_beizhu = ""; string CC_cardName = ""; string CC_score = ""; for (int i = 0; i < DTCC_CardContent.Rows.Count; i++) { CC_cardCode = DTCC_CardContent.Rows[i]["cardCode"].ToString(); CC_item = DTCC_CardContent.Rows[i]["item"].ToString(); CC_beizhu = DTCC_CardContent.Rows[i]["beizhu"].ToString(); CC_cardName = DTCC_CardContent.Rows[i]["cardName"].ToString(); CC_score = DTCC_CardContent.Rows[i]["score"].ToString(); visitApi("SetCardContent?cardCode=" + CC_cardCode + "&item=" + CC_item + "&beizhu=" + CC_beizhu + "&cardName=" + CC_cardName + "&multisign=1" + "&score=" + CC_score + "&entrance=" + StartAppraisal.AppraisalType); } break; case 3: DataTable DTCC_Cardcount = StartSetDistrictCardNumber.DT_Cardcount; string DTCC_districtCode = ""; string DTCC_districtName = ""; string DTCC_cardCode = ""; string DTCC_cardName = ""; string DTCC_cardMaxCount = ""; string DTCC_cardItemScore = ""; for (int i = 0; i < DTCC_Cardcount.Rows.Count; i++) { DTCC_districtCode = DTCC_Cardcount.Rows[i]["DistrictCode"].ToString(); DTCC_districtName = DTCC_Cardcount.Rows[i]["DistrictName"].ToString(); DTCC_cardCode = DTCC_Cardcount.Rows[i]["CardCode"].ToString(); DTCC_cardName = DTCC_Cardcount.Rows[i]["CardName"].ToString(); DTCC_cardMaxCount = DTCC_Cardcount.Rows[i]["CardMaxCount"].ToString(); DTCC_cardItemScore = DTCC_Cardcount.Rows[i]["CardItemScore"].ToString(); visitApi("SetCardCount?districtCode=" + DTCC_districtCode + "&districtName=" + DTCC_districtName + "&cardCode=" + DTCC_cardCode + "&cardName=" + DTCC_cardName + "&cardMaxCount=" + DTCC_cardMaxCount + "&cardScore=" + DTCC_cardItemScore + "&entrance=" + StartAppraisal.AppraisalType); } break; case 4: //DT_UserInfo DataTable DT_UserInfo = StartSetUsrPermission.DT_UserInfo; string Account = ""; string Password = ""; string RealName = ""; string DistrictCode = ""; string DistrictName = ""; int Type = 0; for (int i = 0; i < DT_UserInfo.Rows.Count; i++) { Account = DT_UserInfo.Rows[i]["Account"].ToString(); Password = DT_UserInfo.Rows[i]["Password"].ToString(); RealName = DT_UserInfo.Rows[i]["RealName"].ToString(); DistrictCode = DT_UserInfo.Rows[i]["DistrictCode"].ToString(); DistrictName = DT_UserInfo.Rows[i]["DistrictName"].ToString(); Type = int.Parse(DT_UserInfo.Rows[i]["Type"].ToString()); visitApi("SetUser?Account=" + Account + "&Password="******"&RealName=" + RealName + "&DistrictCode=" + DistrictCode + "&DistrictName=" + DistrictName + "&Type=" + Type + "&entrance=" + StartAppraisal.AppraisalType); } break; } SetPos setpos = new SetPos(SetTextMesssage); this.Invoke(setpos, new object[] { ipos, vinfo }); } else { this.label1.Text = "正在生成,当前进度:" + (++ipos) + "/5"; this.progressBar1.Value = Convert.ToInt32((ipos) * 20); switch (ipos) { case 0: this.textBox1.AppendText("正在生成\r\n"); break; case 1: this.textBox1.AppendText("正在生成测评卡片\r\n"); break; case 2: this.textBox1.AppendText("正在分配测评卡片\r\n"); break; case 3: this.textBox1.AppendText("正在生成用户\r\n"); break; case 4: this.textBox1.AppendText("正在分配用户\r\n"); this.textBox1.AppendText("完成!!!\r\n"); break; } } }
private void SetTextMessage(int ipos) { if (this.InvokeRequired) { SetPos setpos = new SetPos(SetTextMessage); this.Invoke(setpos, new object[] { ipos }); } else { this.label3.Text = ipos / 60 + ":" + ipos % 60 + "/" + ((int)wi.Second)/60 + ":" + ((int) wi.Second)%60; this.progressBar1.Value = Convert.ToInt32(ipos); } }
public void visit(SetPos setPos) { setPos.expression1.accept(this); setPos.expression2.accept(this); }