Question File System Stuff

stulish

Well-known member
Joined
Jun 6, 2013
Messages
61
Programming Experience
3-5
Hi guys,

I am working on a recording program, that records instrument data via a serial connection along with screen shots from 4 displays and mono audio from 10 positions, this is all working fine, my problem seems to be when saving and compressing the files.

Currently i have two directories ODD and EVEN, during the odd minutes the data is saved to the ODD directory and during the even minutes to the EVEN directory; then at 15 seconds past the minute the program compressess all of the data in the last directory (so if the current minute is even then it will compress the ODD directory), and saves this data to 3 places, the first is to the local hard drive and then to a removable drive and also a fixed off site drive.

Currently i have the file locations all set to the local drive but i have noticed the GUI freezes for about 2-3 seconds while it does the compressing and saving of the data to the various locations.

The program i have created uses a DLL i have created with the compress and save functions in it, so basically at the start up of the program i call the DLL and this schedules the compressing of data to occur every minute at 15 seconds past the minute, and to also then copy the compressed zip file to the other 2 locations.

Do you guys have any ideas how to get around this, the GUI freezing isn't such a problem, but it can miss the odd screen capture if it is scheduled to occur when the freeze happens.


Hopefully you understand what i am trying to describe, any ideas or thoughts would be very much appreciated.

Regards

Stu
 

jmcilhinney

VB.NET Forum Moderator
Staff member
Joined
Aug 17, 2004
Messages
14,397
Location
Sydney, Australia
Programming Experience
10+
Presumably you are calling the method that performs the compression and saving on the UI thread, which means that it is too busy doing that to update the UI or react to user input. You can execute that method on a secondary thread so that the UI thread is free to worry about the UI. If you are using .NET 4.5 then you should make use of the Tasks Parallel Library (TPL), i.e. you can create and execute a Task. You will be able to find examples online and yours is about the simplest possible scenario.
 

stulish

Well-known member
Joined
Jun 6, 2013
Messages
61
Programming Experience
3-5
Thanks I am using 4.5 so will have a look.

I'm not used to threads, I thought for some reason (don't ask me why) that if I created a dll to do the work and then just started the dll from my main program it would use a different thread.

Thanks for the advice I will go and have a look
 
Top Bottom