gdscei Posted March 29, 2015 Report Posted March 29, 2015 I apologise for my lack of knowledge with this type of stuff, and so if anyone can point me in the right direction, that'd be great. I am currently having the problem with FSUIPC and this DLL that, whenever opening the simulator, or the simulator crashing, it also affects my application - for example, during startup of the simulator, I am unable to move the application window around, like it's "hanging" waiting for the simulator. Is there a way to fix this? Do I need to run the "connection" in a seperate thread?
Paul Henty Posted March 29, 2015 Report Posted March 29, 2015 Do I need to run the "connection" in a seperate thread? Yes, if you don't like the blocking behaviour on the main UI thread. The DLL was first written about 9 years ago against the .NET 2 framework. Back then multi-threading and async was not as easy as it is now in .NET 4. I'm considering dropping .NET 2 support for the next version. If I do, I can make 'asnyc' versions the IO methods so that it doesn't block the UI thread and you'll be able to use a 'callback' model if you prefer this. But for now, if you're using .NET 2 or above you can use the BackgroundWorker class to call Open() and Process() etc. If you're using .NET 4.0 or above then you can also use the new Task class. The other thing you can do is design your application to minimise the time spent doing things that will potentially block the thread. For example, having a button or menu option that the user can use to connect to FS, rather than having your program automatically looking for a connection until if finds one. Paul
gdscei Posted April 10, 2015 Author Report Posted April 10, 2015 Yes, if you don't like the blocking behaviour on the main UI thread. The DLL was first written about 9 years ago against the .NET 2 framework. Back then multi-threading and async was not as easy as it is now in .NET 4. I'm considering dropping .NET 2 support for the next version. If I do, I can make 'asnyc' versions the IO methods so that it doesn't block the UI thread and you'll be able to use a 'callback' model if you prefer this. But for now, if you're using .NET 2 or above you can use the BackgroundWorker class to call Open() and Process() etc. If you're using .NET 4.0 or above then you can also use the new Task class. The other thing you can do is design your application to minimise the time spent doing things that will potentially block the thread. For example, having a button or menu option that the user can use to connect to FS, rather than having your program automatically looking for a connection until if finds one. Paul Hi Paul, Thanks a lot. Got it working!
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now