public FlightManagementHandler(SmartPilot2020 main) { this.main = main; this.LoadNavigationDatabaseFromFile(); main.MonitoringHandler.AddMessageTimed("NavigationDatabase has been loaded: " + NavigationPoints.Count + " entries", Color.LimeGreen, 4000); this.CurrentPage = FMCPage.INITIALIZATION; }
public void HandleFMCClick(SmartPilot2020 main, TextBox inputBox, int posX, int posY) { // INITIALIZATION button pressed if (Util.IsWithin(posX, 20, 60) && Util.IsWithin(posY, 310, 330)) { this.CurrentPage = FMCPage.INITIALIZATION; } // FLIGHTMANEUVER button pressed if (Util.IsWithin(posX, 70, 110) && Util.IsWithin(posY, 310, 330)) { this.CurrentPage = FMCPage.FLIGHTMANEUVER; } // CLEAR button pressed if (Util.IsWithin(posX, 120, 160) && Util.IsWithin(posY, 310, 330)) { inputBox.Clear(); } // EXC button pressed if (Util.IsWithin(posX, 170, 220) && Util.IsWithin(posY, 310, 330)) { switch (inputBox.Text) { case "[?] JOIN RIGHT HOLDING": if (!main.FlightHandler.AutoPilotActive) { inputBox.Text = "A/P IS NOT ENGAGED"; return; } main.Log("[!] JOINING RIGHT HOLDING"); break; case "[?] JOIN LEFT HOLDING": if (!main.FlightHandler.AutoPilotActive) { inputBox.Text = "A/P IS NOT ENGAGED"; return; } main.Log("[!] JOINING LEFT HOLDING"); break; } } // R1 button if (Util.IsWithin(posX, 220, 240) && Util.IsWithin(posY, 90, 105)) { if (this.CurrentPage == FMCPage.INITIALIZATION) { main.FlightHandler.ProtectedPitchUpAngle = Int32.Parse(inputBox.Text); } if (this.CurrentPage == FMCPage.FLIGHTMANEUVER) { if (!main.FlightHandler.AutoPilotActive) { inputBox.Text = "A/P IS NOT ENGAGED"; return; } inputBox.Text = "[?] JOIN RIGHT HOLDING"; } } // R2 button if (Util.IsWithin(posX, 220, 240) && Util.IsWithin(posY, 110, 125)) { if (this.CurrentPage == FMCPage.INITIALIZATION) { main.FlightHandler.ProtectedPitchDownAngle = Int32.Parse(inputBox.Text); } if (this.CurrentPage == FMCPage.FLIGHTMANEUVER) { if (!main.FlightHandler.AutoPilotActive) { inputBox.Text = "A/P IS NOT ENGAGED"; return; } inputBox.Text = "[?] JOIN LEFT HOLDING"; } } // R3 button if (Util.IsWithin(posX, 220, 240) && Util.IsWithin(posY, 130, 145)) { if (this.CurrentPage == FMCPage.INITIALIZATION) { main.FlightHandler.ProtectedRollAngle = Int32.Parse(inputBox.Text); } } // R4 button if (Util.IsWithin(posX, 220, 240) && Util.IsWithin(posY, 150, 165)) { if (this.CurrentPage == FMCPage.INITIALIZATION) { main.FlightHandler.ProtectedAltitude = Int32.Parse(inputBox.Text); } } // R5 button if (Util.IsWithin(posX, 220, 240) && Util.IsWithin(posY, 170, 185)) { if (this.CurrentPage == FMCPage.INITIALIZATION) { main.FlightHandler.ProtectedOverSpeed = Int32.Parse(inputBox.Text); } } // R6 button if (Util.IsWithin(posX, 220, 240) && Util.IsWithin(posY, 190, 205)) { if (this.CurrentPage == FMCPage.INITIALIZATION) { main.FlightHandler.ProtectedStallSpeed = Int32.Parse(inputBox.Text); } } }