• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

MSFS20 MSFS2020 SimConnect in Winforms && Wpf WORKING, but some help needed. CODE EXAMPLES INCLUDED

Assuming the aircraft is actually at an airport, then the first airport in the nearest airport data would be the current airport.
 
Not in the 2020 sim... not yet (unless the current sdk update has changed that). However, it's the only access point you have available to what the sim has for data. Otherwise you'll have to use your own database and perform your own nearest airport SQL search.
 
@jpdise pls forgive the necro but is there a reason your MSFSClient uses a timer loop and calls RequestDataOnSimObject(..... SIMCONNECT_PERIOD.ONCE) instead of using the much more efficient designed-in capability of SimConnect to stream the data after a single RequestDataOnSimObject call ?

Your code is a very rare example of using RequestDataOnSimObject (rather than RequestDataOnSimObjectType) and I'm hoping to morph it into a C# example of its intended use.
 
@B21-soaring , did you get your own C# code working with RequestDataOnSimObject?
I can get such requests to execute without error but never get data back on my "SimConnect.ReceiveMessage();". Repeatedly polling "RequestDataOnSimObjectType()" seems an inelegant solution.

My request (which I make on sim start) looks like this:
C#:
SimConnect.RequestDataOnSimObject(DATA_REQUESTS.MOTION, DEFINITIONS.MOTION, (uint)SIMCONNECT_SIMOBJECT_TYPE.USER, SIMCONNECT_PERIOD.SECOND, SIMCONNECT_DATA_REQUEST_FLAG.CHANGED, 0, 0, 0);

(MOTION is essentially pitch, bank and heading).
 
do you have the simConnect.AddToDataDefinition statements to build the return structure?

creating the event ?
simconnect.OnRecvSimobjectData += new SimConnect.RecvSimobjectDataEventHandler(SimConnect_OnRecvSimobjectData);
 
Yep - both of them. I'm going to run it again and double check that I get a sim start. Perhaps I can duplicate the RequestDataOnSimObject() in the Unpaused event too as belt & braces... Will report back.

Edit: Sure enough, a combination of factors. I was calling RequestDataOnSimObject() only on the sim start event, which doesn't get triggered if the sim is already running when my code starts. Thanks for your help @ZenMusic .
 
P.S. I'll be happy to post my working WinForms & WPF implementation if anyone would like to see it.
Hi there.
Yes please , code for WPF C#
I think I got the Forms code covered thanks to post in sticky...

Seems I can not comprehend how to get "things started" in WPF.
Complete SLN if possible ( a basic one will do )

Thank you
Greetings
Francisco - Chile
 
Back
Top