I have to deal with like 10 binary files, each larger than 100MB. I have written a single thread program using BinaryReader, and it worked well. I want to make it parallel by using
Parallel.For(0,10, i=>
{
-------------
BinaryReader BR = new BinaryReader(File.Open(Files[i], FileMode.Open));
While (BR.BaseStream.Position < BR.BaseStream.Length)
{
Uint64 a = BR.ReadUInt64();
ProgressBar[i].Value = Convert.ToInt32( 10* BR.BaseStream.Position / BR.BaseStream.Length); //error
}
-------------
} );
updating progressbar (owned by UI Thread) is the problem
each thread has its own progressbar control instance, but they cannot touch it.