December 1, 200421 yr 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
December 1, 200421 yr 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
December 2, 200421 yr 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.
December 2, 200421 yr 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
December 2, 200421 yr Oke Bill, thanks! I really hope MS will make it possible in the next version of MSFS.
December 3, 200421 yr 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
December 4, 200421 yr 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