Exemplo n.º 1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (txtFlyAtlanticPassword.Text != "")
            {
                if (FlightDatabase.ValidateLogin(txtFlyAtlanticEmail.Text, txtFlyAtlanticPassword.Text))
                {
                    Properties.Settings.Default.Email    = txtFlyAtlanticEmail.Text;
                    Properties.Settings.Default.Password = txtFlyAtlanticPassword.Text;
                }
                else
                {
                    MessageBox.Show("Could not validate provided FlyAtlantic credentials.", "Bad login", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }

            Properties.Settings.Default.Save();
        }
Exemplo n.º 2
0
        public App()
        {
            Application.ApplicationExit += new EventHandler(this.OnApplicationExit);
            InitializeComponent();

            try
            {
                if (!FlightDatabase.ValidateLogin(Properties.Settings.Default.Email, Properties.Settings.Default.Password))
                {
                    settingsFrm.Show();
                }
            }
            catch (Exception crap)
            {
                Console.WriteLine(App.GetFullMessage(crap));
            }

            timer.Start();
        }
Exemplo n.º 3
0
        /// <summary>
        /// Waits for assigned flight
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void GetFlightTimer_Tick(object sender, EventArgs e)
        {
            try
            {
                if (!FlightDatabase.ValidateLogin(Properties.Settings.Default.Email, Properties.Settings.Default.Password))
                {
                    return;
                }

                // check for assigned flight
                if (flight.GetFlightPlan() != null)
                {
                    timer.Tick -= new EventHandler(GetFlightTimer_Tick);
                    TrayIcon.SetStatusText("Waiting for Simulator!");
                }
            }
            catch (Exception crap)
            {
                Console.WriteLine("GetFlightTimer_Tick \r\n {0}", App.GetFullMessage(crap));
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// Waits for simulator connection
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void WaitForSimulatorConnectionTimer_Tick(object sender, EventArgs e)
        {
            try
            {
                if (!FlightDatabase.ValidateLogin(Properties.Settings.Default.Email, Properties.Settings.Default.Password))
                {
                    return;
                }

                if (Telemetry.Connect())
                {
                    timer.Tick -= new EventHandler(WaitForSimulatorConnectionTimer_Tick);
                    telemetryTimer.Start();
                }

                // wait for simulator to enable Start Flight Menu Item
            }
            catch (Exception crap)
            {
                Console.WriteLine("GetFlightTimer_Tick \r\n {0}", App.GetFullMessage(crap));
            }
        }
Exemplo n.º 5
0
        private void WaitForDepartureAirfield(object sender, EventArgs e)
        {
            try
            {
                if (!FlightDatabase.ValidateLogin(Properties.Settings.Default.Email, Properties.Settings.Default.Password))
                {
                    return;
                }

                if (flight.LastTelemetry == null)
                {
                    return;
                }
                if (flight.LoadedFlightPlan == null)
                {
                    return;
                }
                if (flight.LastTelemetry.Location.GetDistanceTo(flight.LoadedFlightPlan.DepartureAirfield.Position) < 5000)
                {
                    timer.Tick -= new EventHandler(WaitForDepartureAirfield);

                    flight.StartFlight();

                    TrayIcon.ShowBalloonTip(ToolTipIcon.Info,
                                            String.Format("{0} from {1} to {2}",
                                                          flight.LoadedFlightPlan.AtcCallsign,
                                                          flight.LoadedFlightPlan.DepartureAirfield.Identifier,
                                                          flight.LoadedFlightPlan.ArrivalAirfield.Identifier),
                                            "Start flying!");
                }
            }
            catch (Exception crap)
            {
                Console.WriteLine("GetFlightTimer_Tick \r\n {0}", App.GetFullMessage(crap));
            }
        }