private void UpdateStatus(string text, int progressBarValue)
{
var invokable = new Action(delegate {
if (progressBarValue < pbProgress.Value && pbProgress.Value != 100) {
// probably re-initializing filesystem after map autodetect
return;
}
lblStatus.Text = "Status: " + text;
if (progressBarValue < 100)
// forces 'instant update'
pbProgress.Value = progressBarValue + 1;
pbProgress.Value = progressBarValue;
});
if (InvokeRequired)
Invoke(invokable);
else
invokable();
}