Skip to content
View in the app

A better way to browse. Learn more.

The AVSIM Community

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

.NET

Featured Replies

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

  • Moderator

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

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.

  • Moderator

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

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

  • Moderator

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

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

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.