//进度条同步显示的方法
public void CommonProgressHandle(Action<Action> bizAct, int max, string msg) { using (SimpleProgress sp = new SimpleProgress()) { sp.Message = msg; sp.Position = 0; sp.Max = max; sp.Show(); Action proNextStep = new Action(() => { sp.Position++; sp.Message = msg + string.Format("({0}/{1})", sp.Position, sp.Max); }); if (bizAct != null) { bizAct(proNextStep); } } }
调用的地方:
CommonProgressHandle(nextStep => { nextStep(); }, count, "正在导入XX数据,请稍后......");
标签:同步,记录,进度条,sp,Action,msg,Position,bizAct From: https://www.cnblogs.com/dachuang/p/18154364