Jump to content
The simFlight Network Forums

Search the Community

Showing results for tags 'csharp'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Product Support Forums
    • FSUIPC Support Pete Dowson Modules
    • MyTraffic Support Forum
    • FeelThere Support Forums
    • FS Commander Support Forum
    • Flying W Simulation
    • AConstable Traffic Sounds Support Forum
    • Fabio Merlo Products Support Forum
    • Elite-Air Studio Support Forum
    • Nikola Jovanovic Support Forum
    • Intrasystems Support Forum
    • FScene Support Forum
    • Taburet & DanVFR Support Forum
    • Environ Scenery
  • simFlight DE
  • FS MAGAZIN (DE)
  • simRussia
  • FSUIPC Client DLL for .NET

Categories

There are no results to display.


Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests

Found 2 results

  1. Hi all, I want to add two offsets to FSUIPC in order to save the value of two Q400 variable. These two offsets will be read by Spad.neXt. So I wrote a LUA script that reads variables value (could be 0 or 255) and writes they to FSUIPC offset 66C0 and 66C3. I need to read both variables continuously so I thought of writing a C# program that every 50ms would write to the 0x0D70 offset, and pass the Lua command with the name of my lua script. From what I understand when the 0x0D70 offset is written FSUIPC executes the indicated script via the indicated command, so I expect to have FSUIPC offset 66C0 and 66C3 filled every 50ms with the value of Q400's variables and ready for Spad.neXt. Any comment/criticism/suggestion about this flow? Cheers, Alessandro
  2. Hello, I'm using c# and I can't get anything to work. For example, latitude and longitude: public partial class frmMain : Form { // ===================================== // DECLARE OFFSETS YOU WANT TO USE HERE // ===================================== private Offset<uint> airspeed = new Offset<uint>(0x02BC); private Offset<FsLongitude> playerLon = new Offset<FsLongitude>(0x0568, 8); private Offset<FsLatitude> playerLat = new Offset<FsLatitude>(0x0560, 8); // Create Lon/Lat classes that we'll create using different data formats private Offset<uint> avionicsMaster = new Offset<uint>(0x2E80); private FsLatitude latitude; private FsLongitude longitude; public frmMain() { this.latitude = this.playerLat.Value; this.longitude = this.playerLon.Value; InitializeComponent(); configureForm(); // Start the connection timer to look for a flight sim this.timerConnection.Start(); } // This method is called every 1 second by the connection timer. private void timerConnection_Tick(object sender, EventArgs e) { // Try to open the connection try { FSUIPCConnection.Open(); // If there was no problem, stop this timer and start the main timer this.timerConnection.Stop(); this.timerMain.Start(); showLatLon(); // Update the connection status configureForm(); } catch { // No connection found. Don't need to do anything, just keep trying } } private void showLatLon() { this.lat.Text = this.latitude.ToString(false, "d", 6); this.lon.Text = this.longitude.ToString(false, "d", 6); // Update the information on the form // (See the Examples Application for more information on using Offsets). // 1. Airspeed double airspeedKnots = (double)this.airspeed.Value / 128d; this.txtAirspeed.Text = airspeedKnots.ToString("F0"); // 2. Master Avionics this.chkAvionicsMaster.Checked = avionicsMaster.Value > 0; } // This method runs 20 times per second (every 50ms). This is set on the timerMain properties. private void timerMain_Tick(object sender, EventArgs e) { // Call process() to read/write data to/from FSUIPC // We do this in a Try/Catch block incase something goes wrong try { FSUIPCConnection.Process(); showLatLon(); } catch (Exception ex) { // An error occured. Tell the user and stop this timer. this.timerMain.Stop(); MessageBox.Show("Communication with FSUIPC Failed\n\n" + ex.Message, "FSUIPC", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); // Update the connection status configureForm(); // start the connection timer this.timerConnection.Start(); } } // This runs when the master avionics tick has been changed private void chkAvionicsMaster_CheckedChanged(object sender, EventArgs e) { // Update the FSUIPC offset with the new value (1 = Checked/On, 0 = Unchecked/Off) this.avionicsMaster.Value = (uint)(this.chkAvionicsMaster.Checked ? 1 : 0); } // Configures the status label depending on if we're connected or not private void configureForm() { if (FSUIPCConnection.IsOpen) { this.lblConnectionStatus.Text = "Connected to " + FSUIPCConnection.FlightSimVersionConnected.ToString(); this.lblConnectionStatus.ForeColor = Color.Green; } else { this.lblConnectionStatus.Text = "Disconnected. Looking for Flight Simulator..."; this.lblConnectionStatus.ForeColor = Color.Red; } } private void control_ValueChanged(object sender, EventArgs e) { // Called whenever one of the values on the form changes // Create the new showLatLon(); } // Form is closing so stop all the timers and close FSUIPC Connection private void frmMain_FormClosing(object sender, FormClosingEventArgs e) { this.timerConnection.Stop(); this.timerMain.Stop(); FSUIPCConnection.Close(); } } That returns: Anyone knows why? ;( Appreciate for reading, Aidas
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.