111,120
社区成员
发帖
与我相关
我的任务
分享
private void builder_BuildProgressChanged(System.Int32 progress, System.String state)
{
if (this.lvwInstance.InvokeRequired)
{
this.lvwInstance.Invoke(this.SetInstanceState, new System.Object[] { progress as System.Object, state as System.Object }); // 该行报异常:NullReferenceException
}
else
{
this.SetInstanceState(progress, state);
}
if (this.pgbBuild.InvokeRequired)
{
this.pgbBuild.Invoke(this.SetProgress, new System.Object[] { (progress + 1) as System.Object });
}
else
{
this.SetProgress(progress + 1);
}
}
private delegate void SetInstanceCallBack(System.Int32 index, System.String state);
private SetInstanceCallBack SetInstanceState;
private delegate void SetProgressCallBack(System.Int32 progress);
private SetProgressCallBack SetProgress;
private void _SetInstanceState(System.Int32 index, System.String state)
{
this.lvwInstance.Items[index].SubItems["colState"].Text = state;
}
private void _SetProgress(System.Int32 progress)
{
if (progress < 0)
{
this.pgbBuild.Value = 0;
}
else if (progress > this.pgbBuild.Maximum)
{
this.pgbBuild.Value = this.pgbBuild.Maximum;
}
else
{
this.pgbBuild.Value = progress;
}
}