I found a solution to the above problem.
First of all, put all of the rendering code into a separate method in your object.
Then call it using tasks to spawn its own thread:
var runningTask = Task.Factory.StartNew(() => MakeMovie());
Next, have the ProgressChanged method simply update a variable that is global to the main class (or form)
Finally put a timer on the form that ticks every 100 milliseconds and updates the progressbar from the global variable.
First of all, put all of the rendering code into a separate method in your object.
Then call it using tasks to spawn its own thread:
var runningTask = Task.Factory.StartNew(() => MakeMovie());
Next, have the ProgressChanged method simply update a variable that is global to the main class (or form)
Finally put a timer on the form that ticks every 100 milliseconds and updates the progressbar from the global variable.
private void timerRendering_Tick(object sender, EventArgs e) // called form timer
{
if (iProgressBarValue >= 100)
{
tRendering.Enabled = false;
tRendering.Stop();
}
UpdateProgressBar(); // using the current iProgressBarValue
}
private void participant_ProgressChanged(object sender, Splicer.Renderer.ProgressChangedEventArgs e) //Callback called from spicer rendering code.
{
iProgressBarValue = (int)(e.Progress * 100) + 1;
}