So I really need to understand packets better.
Because of this I'm making an inspector tool to make my life a lot faster in the long run. The idea is I can then use this tool with a proxy server to see what the vanilla YSFlight Server does - that way I can learn from and emulate it.
I've made the UI for the tool so far, but I've hit a small snag today.
OYS is currently written so that the program starts, it then creates a new thread for the user interface and then starts an application for the main window to run on in that new thread.
I cannot have more than one application running per thread - something I didn't know was not allowed until today.
The solution is now to create a new thread to run a WPF application in, but then the WPF application thread will need to be able to accept input from the main program, telling it to make a new window, or close one etc.
It's not TOO much work to change the way that works but I won't get anywhere at all without it.
So to summarise, I do currently make a UI thread, but that UI thread and window creation are tied - the UI thread doesn't listen for any input from the main program. I need to change that, so that I can make more windows.
And that's the goal for the next few days: Make a new "application" interface - that is, a code-behind that can accept commands and input from the main program.
EDIT: YAY I DID IT!
So, the way forwards was to:
Create a Singleton Instance for handling the application side of the UI, then re-write and clean up the current userinterfaces to create their window through that singleton object. The clients still use their own dispatcher, which really just refers back to the UI thread.
To be clear: You can only have one WPF Application per AppDomain (Program). My previous method was trying to make new applications everytime I needed a window. I instead needed to make one Application and then make that application be able to create windows when I tell it to.
Next step will be to code a proxy mode into the connection, confirm that's working, and then link the inspector.
I am an accountant working full-time (and some). I'm not here as often as I would like to be. Send a message if you need me. There are a few people in the community who can get in contact with me urgently if you need - don't be afraid to ask. I just don't check here as frequently as I used to. Sorry!