示例#1
0
 public void HydEng1Off()
 {
     if (Aircraft.pmdg737.HYD_PumpSw_eng[1].Value != 0)
     {
         FSUIPCConnection.SendControlToFS(PMDG_737_NGX_Control.EVT_OH_HYD_ENG1, ClkR);
     }
 }
        // This method runs 10 times per second (every 100ms). 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();
                inst.MonitorN1Limit();
                if (Aircraft.AircraftName.Value.Contains("PMDG"))
                {
                    Aircraft.pmdg737.RefreshData();
                    Aircraft.pmdg747.RefreshData();
                }
                inst.ReadAircraftState();
                if (!inst.PostTakeOffChecklist())
                {
                    inst.PostTakeOffChecklist();
                }
            }


            catch (Exception ex)
            {
                // An error occured. Tell the user and stop this timer.
                this.timerMain.Stop();
                logger.Debug($"High priority instruments failed to read: {ex.Message}");
                // Update the connection status
                // start the connection timer
                this.timerConnection.Start();
            }
        }
        } // autoBrakeMediumRadioButton_CheckedChanged.

        private void autoBrakeMaximumRadioButton_CheckedChanged(object sender, EventArgs e)
        {
            if (autoBrakeMaximumRadioButton.Checked)
            {
                FSUIPCConnection.SendControlToFS(PMDG_777X_Control.EVT_ABS_AUTOBRAKE_SELECTOR, 5);
            }
        } // autoBrakeMaximumRadioButton_CheckedChanged
 private void txtSpeed_KeyDown(object sender, KeyEventArgs e)
 {
     // increment speed
     if (e.KeyCode == Keys.Oemplus)
     {
         FSUIPCConnection.SendControlToFS(PMDG_737_NGX_Control.EVT_MCP_SPEED_SELECTOR, Aircraft.Inc);
     }
     // increment altitude fast
     if ((e.Shift && e.KeyCode == Keys.Oemplus))
     {
         for (int i = 0; i < 5; i++)
         {
             FSUIPCConnection.SendControlToFS(PMDG_737_NGX_Control.EVT_MCP_SPEED_SELECTOR, Aircraft.Inc);
         }
     }
     // decrement altitude slowly
     if (e.KeyCode == Keys.OemMinus)
     {
         FSUIPCConnection.SendControlToFS(PMDG_737_NGX_Control.EVT_MCP_SPEED_SELECTOR, Aircraft.Dec);
     }
     // decrement altitude fast
     if ((e.Shift && e.KeyCode == Keys.OemMinus))
     {
         for (int i = 0; i < 5; i++)
         {
             FSUIPCConnection.SendControlToFS(PMDG_737_NGX_Control.EVT_MCP_SPEED_SELECTOR, Aircraft.Dec);
         }
     }
 }
示例#5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="fs"></param>
        public bool StartFlight()
        {
            try
            {
                PirepID = FlightDatabase.StartFlight(this);
                Telemetry.SetValue(FSUIPCOffsets.engine1, false);
                Telemetry.SetValue(FSUIPCOffsets.engine2, false);
                Telemetry.SetValue(FSUIPCOffsets.engine3, false);
                Telemetry.SetValue(FSUIPCOffsets.engine4, false);
                Telemetry.SetValue(FSUIPCOffsets.parkingBrake, true);

                Telemetry.SetValue(FSUIPCOffsets.environmentDateTimeHour, DateTime.UtcNow.Hour);
                Telemetry.SetValue(FSUIPCOffsets.environmentDateTimeMinute, DateTime.UtcNow.Minute);
                Telemetry.SetValue(FSUIPCOffsets.environmentDateTimeDayOfYear, DateTime.UtcNow.DayOfYear);
                Telemetry.SetValue(FSUIPCOffsets.environmentDateTimeYear, DateTime.UtcNow.Year);

                string Message = "Welcome to FlyAtlantic Acars";
                FSUIPCOffsets.messageWrite.Value    = Message;
                FSUIPCOffsets.messageDuration.Value = 10;
                FSUIPCConnection.Process();

                phase         = FlightPhases.PREFLIGHT;
                FlightRunning = true;
            }
            catch (Exception crap)
            {
                throw new Exception("Failed to start flight.", crap);
            }

            // TODO: do all stuff via telemetry to force desired values


            return(FlightRunning);
        }
示例#6
0
 public void Engine1BleedOn()
 {
     if (Aircraft.pmdg737.AIR_BleedAirSwitch[0].Value != 1)
     {
         FSUIPCConnection.SendControlToFS(PMDG_737_NGX_Control.EVT_OH_BLEED_ENG_1_SWITCH, ClkL);
     }
 }
 private void txtHeading_KeyDown(object sender, KeyEventArgs e)
 {
     // increment heading
     if (e.KeyCode == Keys.Oemplus)
     {
         FSUIPCConnection.SendControlToFS(PMDG_737_NGX_Control.EVT_MCP_HEADING_SELECTOR, Aircraft.Inc);
     }
     // increment heading fast
     if ((e.Shift && e.KeyCode == Keys.Oemplus))
     {
         for (int i = 0; i < 5; i++)
         {
             FSUIPCConnection.SendControlToFS(PMDG_737_NGX_Control.EVT_MCP_HEADING_SELECTOR, Aircraft.Inc);
         }
     }
     // decrement heading slowly
     if (e.KeyCode == Keys.OemMinus)
     {
         FSUIPCConnection.SendControlToFS(PMDG_737_NGX_Control.EVT_MCP_HEADING_SELECTOR, Aircraft.Dec);
     }
     // decrement heading fast
     if ((e.Shift && e.KeyCode == Keys.OemMinus))
     {
         for (int i = 0; i < 5; i++)
         {
             FSUIPCConnection.SendControlToFS(PMDG_737_NGX_Control.EVT_MCP_HEADING_SELECTOR, Aircraft.Dec);
         }
     }
 }
示例#8
0
 public void WindowHeatRightSideOff()
 {
     if (FSUIPCConnection.ReadLVar("switch_139_73X") != 0)
     {
         FSUIPCConnection.SendControlToFS(PMDG_737_NGX_Control.EVT_OH_ICE_WINDOW_HEAT_4, ClkR);
     }
 }
示例#9
0
 // overhead probe heat
 // left
 public void ProbeHeatLeftOn()
 {
     if (FSUIPCConnection.ReadLVar("switch_140_73X") != 100)
     {
         FSUIPCConnection.SendControlToFS(PMDG_737_NGX_Control.EVT_OH_ICE_PROBE_HEAT_1, ClkL);
     }
 }
示例#10
0
 public void WindowHeatLeftForwardOff()
 {
     if (FSUIPCConnection.ReadLVar("switch_136_73X") != 0)
     {
         FSUIPCConnection.SendControlToFS(PMDG_737_NGX_Control.EVT_OH_ICE_WINDOW_HEAT_2, ClkR);
     }
 }
示例#11
0
 // right forward
 public void WindowHeatRightForwardOn()
 {
     if (FSUIPCConnection.ReadLVar("switch_138_73X") != 100)
     {
         FSUIPCConnection.SendControlToFS(PMDG_737_NGX_Control.EVT_OH_ICE_WINDOW_HEAT_3, ClkL);
     }
 }
示例#12
0
 // Overhead window heat
 // left side
 public void WindowHeatLeftSideOn()
 {
     if (FSUIPCConnection.ReadLVar("switch_135_73X") != 100)
     {
         FSUIPCConnection.SendControlToFS(PMDG_737_NGX_Control.EVT_OH_ICE_WINDOW_HEAT_1, ClkL);
     }
 }
示例#13
0
 public void Eng2FuelCutOff()
 {
     if (FSUIPCConnection.ReadLVar("switch_689_73X") != 100)
     {
         FSUIPCConnection.SendControlToFS(PMDG_737_NGX_Control.EVT_CONTROL_STAND_ENG2_START_LEVER, ClkL);
     }
 }
示例#14
0
 // Pedestal - Fuel Cut off
 public void Eng1FuelIdle()
 {
     if (FSUIPCConnection.ReadLVar("switch_688_73X") != 0)
     {
         FSUIPCConnection.SendControlToFS(PMDG_737_NGX_Control.EVT_CONTROL_STAND_ENG1_START_LEVER, ClkR);
     }
 }
示例#15
0
 // DC Meter Source
 public void ElecDCSource(int s)
 {
     if (s >= 0 && s <= 7)
     {
         FSUIPCConnection.SendControlToFS(PMDG_737_NGX_Control.EVT_OH_ELEC_DC_METER, s);
     }
 }
示例#16
0
 public void ProbeHeatRightOff()
 {
     if (FSUIPCConnection.ReadLVar("switch_141_73X") != 0)
     {
         FSUIPCConnection.SendControlToFS(PMDG_737_NGX_Control.EVT_OH_ICE_PROBE_HEAT_2, ClkR);
     }
 }
示例#17
0
 public void APUBleedOff()
 {
     if (Aircraft.pmdg737.AIR_APUBleedAirSwitch.Value != 0)
     {
         FSUIPCConnection.SendControlToFS(PMDG_737_NGX_Control.EVT_OH_BLEED_APU_SWITCH, ClkR);
     }
 }
示例#18
0
 public void WingAntiIceOff()
 {
     if (FSUIPCConnection.ReadLVar("switch_156_73X") != 0)
     {
         FSUIPCConnection.SendControlToFS(PMDG_737_NGX_Control.EVT_OH_ICE_WING_ANTIICE, ClkR);
     }
 }
示例#19
0
 public void Engine2BleedOff()
 {
     if (Aircraft.pmdg737.AIR_BleedAirSwitch[1].Value != 0)
     {
         FSUIPCConnection.SendControlToFS(PMDG_737_NGX_Control.EVT_OH_BLEED_ENG_2_SWITCH, ClkR);
     }
 }
示例#20
0
 // engine 1 anti-ice
 public void Engine1AntiIceOn()
 {
     if (FSUIPCConnection.ReadLVar("switch_157_73X") != 100)
     {
         FSUIPCConnection.SendControlToFS(PMDG_737_NGX_Control.EVT_OH_ICE_ENGINE_ANTIICE_1, ClkL);
     }
 }
 private void txtAltitude_KeyDown(object sender, KeyEventArgs e)
 {
     // increment altitude by 100 feet
     if (e.KeyCode == Keys.Oemplus)
     {
         FSUIPCConnection.SendControlToFS(PMDG_737_NGX_Control.EVT_MCP_ALTITUDE_SELECTOR, Aircraft.Inc);
     }
     // increment altitude by 500 feet
     if ((e.Shift && e.KeyCode == Keys.Oemplus))
     {
         for (int i = 0; i < 5; i++)
         {
             FSUIPCConnection.SendControlToFS(PMDG_737_NGX_Control.EVT_MCP_ALTITUDE_SELECTOR, Aircraft.Inc);
         }
     }
     // decrement altitude by 100 feet
     if (e.KeyCode == Keys.OemMinus)
     {
         FSUIPCConnection.SendControlToFS(PMDG_737_NGX_Control.EVT_MCP_ALTITUDE_SELECTOR, Aircraft.Dec);
     }
     // decrement altitude by 500 feet
     if ((e.Shift && e.KeyCode == Keys.OemMinus))
     {
         for (int i = 0; i < 5; i++)
         {
             FSUIPCConnection.SendControlToFS(PMDG_737_NGX_Control.EVT_MCP_ALTITUDE_SELECTOR, Aircraft.Dec);
         }
     }
 }
示例#22
0
 public void Engine2AntiIceOff()
 {
     if (FSUIPCConnection.ReadLVar("switch_158_73X") != 0)
     {
         FSUIPCConnection.SendControlToFS(PMDG_737_NGX_Control.EVT_OH_ICE_ENGINE_ANTIICE_2, ClkR);
     }
 }
示例#23
0
 // The connect/disconnect buton
 private void btnToggleConnection_Click(object sender, EventArgs e)
 {
     if (FSUIPCConnection.IsOpen)
     {
         // Connection is currently open
         // Stop the main timer
         this.timerMain.Stop();
         // Close the connection
         FSUIPCConnection.Close();
     }
     else
     {
         // Try to open the connection
         try
         {
             this.lblConnectionStatus.Text      = "Looking for a flight simulator...";
             this.lblConnectionStatus.ForeColor = Color.Goldenrod;
             FSUIPCConnection.Open();
             // If there was no problem, start the main timer
             this.timerMain.Start();
         }
         catch (Exception ex)
         {
             // An error occured. Tell the user.
             MessageBox.Show("Connection Failed\n\n" + ex.Message, "FSUIPC", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         }
     }
     configureForm();
 }
示例#24
0
 public void TrimAirOff()
 {
     if (Aircraft.pmdg737.AIR_TrimAirSwitch.Value != 0)
     {
         FSUIPCConnection.SendControlToFS(PMDG_737_NGX_Control.EVT_OH_AIRCOND_TRIM_AIR_SWITCH_800, Aircraft.ClkR);
     }
 }
示例#25
0
        // This method runs 20 times per second (every 50ms). This is set in the form constructor above.
        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();

                // Update the information on the form
                // (See the Examples Application for more information on using Offsets).

                Data data = parseData();

                this.txtAirspeed.Text    = data.parsedAirspeed.ToString();
                this.txtGroundspeed.Text = data.parsedGS.ToString("F0");
                this.txtVertspeed.Text   = data.parsedVertSpd.ToString("F0");
                this.txtHeading.Text     = data.parsedHDG.ToString("F0");
                this.txtSimNum.Text      = simStupidNumber.Value.ToString();
                this.txtOnGround.Text    = data.parsedGround.ToString();
            }
            catch (Exception ex)
            {
                // An error occured. Tell the user and stop this timer.
                this.timerMain.Stop();
                System.Windows.MessageBox.Show("Flight Simulator closed! Error:" + ex.Message, "FSUIPC", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                if (Properties.Settings.Default.CloseWithSim)
                {
                    System.Windows.Application.Current.Shutdown();
                }
                // Update the connection status
                configureForm();
            }
        }
示例#26
0
 // left recirculation fan
 public void RecircLeftOn()
 {
     if (Aircraft.pmdg737.AIR_RecircFanSwitch[0].Value != 1)
     {
         FSUIPCConnection.SendControlToFS(PMDG_737_NGX_Control.EVT_OH_BLEED_RECIRC_FAN_L_SWITCH, Aircraft.ClkL);
     }
 }
示例#27
0
        /// <summary>
        /// Metodo per attivare la connessione ad FSUIPC
        /// </summary>
        public void ConnectToFS()
        {
#if !FEDE_DEBUG
            FSUIPCConnection.Open();
#endif
            connected = true;
        }
示例#28
0
 public void RecircRightOff()
 {
     if (Aircraft.pmdg737.AIR_RecircFanSwitch[1].Value != 0)
     {
         FSUIPCConnection.SendControlToFS(PMDG_737_NGX_Control.EVT_OH_BLEED_RECIRC_FAN_R_SWITCH, Aircraft.ClkR);
     }
 }
示例#29
0
        } // autoBrakeMaximumRadioButton_CheckedChanged

        private void speedBrakeTrackBar_KeyDown(object sender, KeyEventArgs e)
        {
            // Standard scrolling for increase value in trackbar.
            if (e.KeyCode == Keys.Right || e.KeyCode == Keys.Up)
            {
                FSUIPCConnection.SendControlToFS(PMDG_777X_Control.EVT_CONTROL_STAND_SPEED_BRAKE_LEVER, Aircraft.ClkL);
            }
            // Standard vscrolling for decrease value in trackbar.
            if (e.KeyCode == Keys.Left || e.KeyCode == Keys.Down)
            {
                FSUIPCConnection.SendControlToFS(PMDG_777X_Control.EVT_CONTROL_STAND_SPEED_BRAKE_LEVER, Aircraft.ClkR);
            }
            if (e.KeyCode == Keys.Home || e.KeyCode == Keys.Oemcomma)
            {
                FSUIPCConnection.SendControlToFS(PMDG_777X_Control.EVT_CONTROL_STAND_SPEED_BRAKE_LEVER_ARM, Aircraft.ClkL);
            }
            if (e.KeyCode == Keys.End || e.KeyCode == Keys.OemPeriod)
            {
                FSUIPCConnection.SendControlToFS(PMDG_777X_Control.EVT_CONTROL_STAND_SPEED_BRAKE_LEVER_UP, Aircraft.ClkL);
            }
            if (e.KeyCode == Keys.OemQuestion)
            {
                FSUIPCConnection.SendControlToFS(PMDG_777X_Control.EVT_CONTROL_STAND_SPEED_BRAKE_LEVER_50, Aircraft.ClkL);
            }
        }
示例#30
0
 public void HydEng2On()
 {
     if (Aircraft.pmdg737.HYD_PumpSw_eng[0].Value != 1)
     {
         FSUIPCConnection.SendControlToFS(PMDG_737_NGX_Control.EVT_OH_HYD_ENG2, ClkL);
     }
 }