multithreading - Running Two Functions at the Same Time in C# -


i have created class library in project scans series of files. in main project uses dll reference, i'd create progress bar shows how many file have been scanned far.

the dll class makes use of foreach loop since it's purpose turn each file hash code. foreach loop has been used join each converted segment of file can have 512 bit long code, , proceeds next file.

i have defined variable in dll class -->

public static int value_ = 0; 

this variable updated @ the end of foreach loop.

now in main project, i'd use variable update progress bar @ same time function in class library project running.

for example :

dll.function(); pb.value = value_; 

i'd appreciate hint on how can implement this.

you can use background worker work , report progress.

worker.workerreportsprogress = true; 

and can have progress report triggered event subscribe to.

worker.progresschanged += new progresschangedeventhandler(worker_progresschanged); 

in doing so, can create progress bar can update based on worker_progresschanged event, triggered method.


Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -