Jump to content
Sign in to follow this  
Guest Alexander_EFG

.NET

Recommended Posts

Guest Alexander_EFG

Has anyone tried to code gauges in C# .NET? I've build a simple gauge that calculates if your landingspeed is too fast or too slow (ckecked with reference speed), but I can't seem to find a way to read data from MSFS. Any ideas?Cheers,Alex

Share this post


Link to post
Share on other sites

Well, regardless of what else you want to use, the basic gauge must be coded in pure C. Many of us are using C++ and GDI+ in guages now, so I don't see any obvious reason why C# could not be included as well.The Aircraft and Panels SDK contains all of the FS variables and key event tokens, so that would be the place to begin looking for the FS interface. :)


Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator

Share this post


Link to post
Share on other sites
Guest Alexander_EFG

Hi Bill,Thanks for answering my call for help! :)There's a subtle difference between C# .NET and C++/C. The obvious reason is simple (keeping it short): .NET compiles into MSIL (MS Intermediate Language). The Just In Time Compiler or short JIT compiles a piece of code on demand. This way .NET ensures that any language can be used on any platform. Actually .NET is more or less the successor of COM+. The only way a C++ application/library is going to "talk" with a .NET assembly is via COM+ Interop or the COM+ wrapper. This is what I ment with MSFS interface to read the data. Is there any COM+ library available fir FS or within FS which does enable me to read MSFS data. The other issue would be getting the gauges displayed within the MSFS window, but that's for later concern.

Share this post


Link to post
Share on other sites

To the best of my knowledge (which is admittedly quite limited!), the short answer is no, which may explain why the inclusion of any C++ is quite limited in gauges. All data exchange with FS must occur in the pure C portions of the gauge code. Relevant data can then be passed to and retrieved from C++ and/or GDI+ routines.


Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator

Share this post


Link to post
Share on other sites
Guest Alexander_EFG

Oke Bill, thanks! I really hope MS will make it possible in the next version of MSFS.

Share this post


Link to post
Share on other sites

Well Alex, you never did state just WHAT "FS data" you are wanting to retrieve. It may well be possible to accomplish your goal, but without knowing just what info you need, no one can actually provide any useful or accurate answer... :)


Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator

Share this post


Link to post
Share on other sites
Guest Alexander_EFG

Bill,Basicly I want to code gauges in C# instead of C++. I know C# pretty well, but I have never coded a line in C or C++. My issues is that I don't have alot of time or interest in learning C. So it comes down to reading data from FS (aircraft state, altitude, that sort of stuff), manipulate the date (pitch, yaw, etc.) and insert it back into FS so that FS will respond to actions in the gauges. Basicly the same things you can do with C/C++ but only in C#.NET...Cheers,Alex

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Tom Allensworth,
    Founder of AVSIM Online


  • Flight Simulation's Premier Resource!

    AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!

    Click here for more information and to see all donations year to date.
×
×
  • Create New...