سؤال

I have an application that reads data on the main form as well as a pop-up window. On my application's main form I am reading real-time serial communication in ASCII. In my pop-up window my program is analyzing that data and capturing pass/fail scenarios.

When I execute my program it works as intended. However, while the program is running (takes ~2 minutes to finish) I can't move my pop-up window around the screen or minimize my main application window. It's as if they're stuck until the operation is complete. I am not getting a "Not Responding" message and am trying to figure out how to be able move/minimize/close windows during the operation.

Is multi-threading the answer? Any help is appreciated.

هل كانت مفيدة؟

المحلول

You are probably performing some very long opração the 'main thread'. Try to create a new 'thread' to run this very large operation, and your form will not be locked.

نصائح أخرى

You will need to use multithreading, or maybe some async/await operations.

http://msdn.microsoft.com/en-us/library/ms173178.aspx

http://msdn.microsoft.com/en-us/library/vstudio/hh191443(v=vs.110).aspx

Hope this helps!

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top