Jump to content
The simFlight Network Forums

A320_Pilot

Members
  • Posts

    58
  • Joined

  • Last visited

Everything posted by A320_Pilot

  1. using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using System.Globalization; using System.Threading; using FSUIPC; namespace FSClient { //---------------------------------------------------------------------------------// public partial class FSClient : Form { private static readonly string AppTitle = "FSClient"; private Offset<long> playerLongitude = new Offset<long>(0x0568); private Offset<long> playerLatitude = new Offset<long>(0x0560); private Offset<int> verticalSpeed = new Offset<int>(0x02C8); private Offset<long> altitude = new Offset<long>(0x0570); private Offset<int> airspeed = new Offset<int>(0x02BC); //---------------------------------------------------------------------------------// public FSClient() { InitializeComponent(); FsLatitude lat = new FsLatitude(playerLatitude.Value); FsLongitude lon = new FsLongitude(playerLongitude.Value); FsLatLonPoint currentPosition = new FsLatLonPoint(lat, lon); } //---------------------------------------------------------------------------------// private void Form1_Load(object sender, EventArgs e) { this.timer1.Enabled = false; this.endfl.Enabled = false; this.label2.Text = ("We expect connection!"); } //---------------------------------------------------------------------------------// private void startfl_Click(object sender, EventArgs e) { try { FSUIPCConnection.Open(); this.startfl.Enabled = false; this.endfl.Enabled = true; this.timer1.Interval = 100; this.timer1.Enabled = true; this.label2.Text = ("Connection is established!"); } catch (Exception ex) { MessageBox.Show(ex.Message, AppTitle, MessageBoxButtons.OK, MessageBoxIcon.Error); } } //---------------------------------------------------------------------------------// private void endfl_Click(object sender, EventArgs e) { try { FSUIPCConnection.Close(); this.startfl.Enabled = true; this.endfl.Enabled = false; this.timer1.Interval = 100; this.timer1.Enabled = false; this.label2.Text = ("Flight is completed, the data is saved!"); } catch (Exception ex) { MessageBox.Show(ex.Message, AppTitle, MessageBoxButtons.OK, MessageBoxIcon.Error); } } //---------------------------------------------------------------------------------// public void displayLocation() { FSUIPCConnection.Process(); FsLatitude lat = new FsLatitude(playerLatitude.Value); FsLongitude lon = new FsLongitude(playerLongitude.Value); this.label13.Text = lon.ToString(); this.label12.Text = lat.ToString(); FsLatLonPoint currentPosition = new FsLatLonPoint(lat, lon); } //---------------------------------------------------------------------------------// private void timer1_Tick(object sender, EventArgs e) { try { //---------------------------------------------------------------------------------// FSUIPCConnection.Process(); //---------------------------------------------------------------------------------// //Verticall speed in meters double verticalSpeed_MetresPerSecond = (double)verticalSpeed.Value / 256d; //---------------------------------------------------------------------------------// //Vertical speed in feets double verticalSpeed_FeetPerMinute = (double)verticalSpeed.Value * 60d * 3.28084d / 256d; //---------------------------------------------------------------------------------// //Altitude in meters double altitude_Metres = (double)altitude.Value / (65536d * 65536d); //---------------------------------------------------------------------------------// //Altitude in feets double altitude_Feet = (double)altitude.Value / (65536d * 65536d) * 3.28084d; //---------------------------------------------------------------------------------// //Airspeed in knots double airpeedKnots = ((double)airspeed.Value / 128d); //---------------------------------------------------------------------------------// this.displayLocation(); } catch (FSUIPCException ex) { if (ex.FSUIPCErrorCode == FSUIPCError.FSUIPC_ERR_SENDMSG) { this.timer1.Enabled = false; this.startfl.Enabled = true; FSUIPCConnection.Close(); MessageBox.Show("The connection to Flight Sim has been lost.", AppTitle, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else { throw ex; } } } //---------------------------------------------------------------------------------// } } This is my new code, but it is not working((((!!!!! How does all this display? Do as in the example, but does not work!
  2. My code not working!((((
  3. Give me please code with a call function with timer! Thanks
  4. using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using FSUIPC; namespace FSClient { public partial class FSClient : Form { private static readonly string AppTitle = "FSClient"; private Offset<long> playerLatitude = new Offset<long>(0x0560); private Offset<long> playerLongitude = new Offset<long>(0x0568); public FSClient() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { } private void button1_Click(object sender, EventArgs e) { try { FSUIPCConnection.Open(); } catch (Exception ex) { MessageBox.Show(ex.Message, AppTitle, MessageBoxButtons.OK, MessageBoxIcon.Error); } } private void Form1_FormClosed(object sender, FormClosedEventArgs e) { FSUIPCConnection.Close(); } private void displayCurrentPosition() { FSUIPCConnection.Process(); FsLongitude lon = new FsLongitude(playerLongitude.Value); FsLatitude lat = new FsLatitude(playerLatitude.Value); this.textBox1.Text = lon.ToString(); this.textBox2.Text = lat.ToString(); } } }
  5. This is a full code
  6. private void displayCurrentPosition() { FSUIPCConnection.Process(); FsLongitude lon = new FsLongitude(playerLongitude.Value); FsLatitude lat = new FsLatitude(playerLatitude.Value); this.textBox1.Text = lon.ToString(); this.textBox2.Text = lat.ToString(); } Where is error? data does not appear!
  7. Can i write in russian language here?
  8. Good afternoon, my name is George! I'm here right now, I want to write a program for FS9 and FSS, which outputs to the data from the simulator, such as the speed of the airplane, the airplane rate, height, lights, vertical! But I don `t know where to start! Help please, where to start?
×
×
  • 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.