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); } } }
/// <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); }
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); } } }
public void WindowHeatRightSideOff() { if (FSUIPCConnection.ReadLVar("switch_139_73X") != 0) { FSUIPCConnection.SendControlToFS(PMDG_737_NGX_Control.EVT_OH_ICE_WINDOW_HEAT_4, ClkR); } }
// 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); } }
public void WindowHeatLeftForwardOff() { if (FSUIPCConnection.ReadLVar("switch_136_73X") != 0) { FSUIPCConnection.SendControlToFS(PMDG_737_NGX_Control.EVT_OH_ICE_WINDOW_HEAT_2, ClkR); } }
// 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); } }
// 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); } }
public void Eng2FuelCutOff() { if (FSUIPCConnection.ReadLVar("switch_689_73X") != 100) { FSUIPCConnection.SendControlToFS(PMDG_737_NGX_Control.EVT_CONTROL_STAND_ENG2_START_LEVER, ClkL); } }
// 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); } }
// 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); } }
public void ProbeHeatRightOff() { if (FSUIPCConnection.ReadLVar("switch_141_73X") != 0) { FSUIPCConnection.SendControlToFS(PMDG_737_NGX_Control.EVT_OH_ICE_PROBE_HEAT_2, ClkR); } }
public void APUBleedOff() { if (Aircraft.pmdg737.AIR_APUBleedAirSwitch.Value != 0) { FSUIPCConnection.SendControlToFS(PMDG_737_NGX_Control.EVT_OH_BLEED_APU_SWITCH, ClkR); } }
public void WingAntiIceOff() { if (FSUIPCConnection.ReadLVar("switch_156_73X") != 0) { FSUIPCConnection.SendControlToFS(PMDG_737_NGX_Control.EVT_OH_ICE_WING_ANTIICE, ClkR); } }
public void Engine2BleedOff() { if (Aircraft.pmdg737.AIR_BleedAirSwitch[1].Value != 0) { FSUIPCConnection.SendControlToFS(PMDG_737_NGX_Control.EVT_OH_BLEED_ENG_2_SWITCH, ClkR); } }
// 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); } } }
public void Engine2AntiIceOff() { if (FSUIPCConnection.ReadLVar("switch_158_73X") != 0) { FSUIPCConnection.SendControlToFS(PMDG_737_NGX_Control.EVT_OH_ICE_ENGINE_ANTIICE_2, ClkR); } }
// 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(); }
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); } }
// 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(); } }
// 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); } }
/// <summary> /// Metodo per attivare la connessione ad FSUIPC /// </summary> public void ConnectToFS() { #if !FEDE_DEBUG FSUIPCConnection.Open(); #endif connected = true; }
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); } }
} // 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); } }
public void HydEng2On() { if (Aircraft.pmdg737.HYD_PumpSw_eng[0].Value != 1) { FSUIPCConnection.SendControlToFS(PMDG_737_NGX_Control.EVT_OH_HYD_ENG2, ClkL); } }