记录个简单的进度条同步显示方法
//进度条同步显示的方法
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数据,请稍后......");