if (isCreate)
{
bool bCreateDWGSuccess = Interop.ByCirAndLineCreSweptSolid(dicCablePoint.ToList()[iKrkuCable].Key, mPointList);
if (bCreateDWGSuccess)
iSuccess++;
else
listVoidCable.Add(dicCablePoint.ToList()[iKrkuCable].Key);
}
else
{
listVoidCable.Add(dicCablePoint.ToList()[iKrkuCable].Key);
}
mPointList.Clear();
frmMatte.mFrmInstance.ProgressStep();
前提: 上图的if判断被for循环包围
frmMatte.g_frmInstance.ProgressStep(); 的意思是进度条+1, 如下代码, 这些只是部分代码.
/// <summary>
/// 设置外部调用的参数名
/// </summary>
public static frmMatte mFrmInstance = null;
/// <summary>
/// 设置进度条总长度
/// </summary>
public static int mProgressBarTotal;
/// <summary>
/// 进度条增长
/// </summary>
internal void ProgressStep()
{
Invoke(new Action(() =>
{
pBar.PerformStep();
//Refresh();
}));
}
这个if判断isCreate是否为True, 是则调用ByCirAndLineCreSweptSolid(), 否则不调用.
但是无论如何都会调进度条++的方法.
BUG出现在: 假设目前是第一次循环, 调用了进度条++的方法, 这个时候进度条不会增长. 而是等到第二次循环时调用ByCirAndLineCreSweptSolid()方法的瞬间才增长. 第二次循环就等第三次才增长.
如果第三次isCreate为false则等到第四次, 如果一直为false那就进度条直到结束都不增长.
然后我在else处也写了ByCirAndLineCreSweptSolid()这个方法, 发现还是不行, 必须等到了if判断true的地方调用ByCirAndLineCreSweptSolid(), 上一次或者上上一次的进度条增长方法使进度条增长才会生效.
所以, 有没有人知道这个问题为什么会出现的么.