Hello again, guys:
This time my question has to do with C# Programming. I finally managed to make the timezones´ function work. However I am having trouble with the AutoSave, this is what I´ve done. But unfortunately it´s not working. May Paul can help me:
First I declare the offsets that I´m going to store & update, then I create variables with to store the value of the first ones. And then inside the setLastValues() method I store the value of them.(This method is called each time the user presses a button/the timer_tick passes through it)
// We declare the offsets:
Offset<long> Latitude = new Offset<long>("update",0x0560);
Offset<long> Longitude = new Offset<long>("update", 0x0568);
Offset<long> Altitude111 = new Offset<long>("update", 0x0570);
Offset<int> Airspeed = new Offset<int>("update", 0x02BC);
Offset<int> Heading = new Offset<int>("update", 0x0580);
long lastlatitude;
long lastlongitude;
long lastaltitude;
int lastairspeed;
int lastheading;
private void setLastValues()
{
this.lastlatitude = this.Latitude.Value;
this.lastlongitude = this.Longitude.Value;
this.lastaltitude = this.Altitude111.Value;
this.lastairspeed = this.Airspeed.Value;
this.lastheading = this.Heading.Value;
}
2. This is the code on the button "Save Flight"
private void pictureBox3_Click(object sender, EventArgs e)
{
if (pictureBox5.Enabled == false && asave.Enabled != true)
{
asave.Start();
asave.Enabled = true;
asave.Interval = 600000;
asave_Tick(null, null);
asave.Tick += new EventHandler(chour_Tick);
setLastValues();
}
else
{
MessageBox.Show("You have to connect to FS first!!/You can click just once");
}
}
Code on the Timer_Tick:
private void asave_Tick(object sender, EventArgs e)
{
setLastValues();
}
And finally, code in the "Load Flight" button:
private void pictureBox4_Click(object sender, EventArgs e)
{
this.Latitude.Value = lastlatitude;
this.Longitude.Value = lastlongitude;
this.Airspeed.Value = lastairspeed;
this.Altitude111.Value = lastaltitude;
this.Heading.Value = lastheading;
FSUIPCConnection.Process("update");
}
But for some reason it is not working, it does load the wrong latitude, longitude, speed and everything gets loaded wrong.
I can´t realize on what I´m doing wrong.
Thank you very much!!
Regards!!