示例#1
0
        public void addTreeItem(FlightEvent ev)
        {
            TreeNode mainNode = acarsTTree.Nodes.Add(ev.GetUTCTimeString() + " | " + ev.id);

            if (ev.type == 2)
            {
                mainNode.ForeColor = Color.OrangeRed;
            }
            else if (ev.type == 0)
            {
                mainNode.ForeColor = Color.Gray;
            }
            mainNode.Nodes.Add("Position: " + ev.latitude.ToString("####.#####", nfi) + " / " + ev.longitude.ToString("####.#####", nfi));
            mainNode.Nodes.Add("Altitude: " + Math.Round(ev.altitude));
            mainNode.Nodes.Add("Airpeed: " + Math.Round(ev.airSpeed) + " / GS: " + Math.Round(ev.groundSpeed));
            mainNode.Nodes.Add("VS: " + Math.Round(ev.verticalSpeed));
            mainNode.Nodes.Add("Heading: " + Math.Round(ev.heading));
            mainNode.Nodes.Add("Com1: " + ev.com1 + " / Transponder: " + ev.transponder);
            mainNode.Nodes.Add("Wind: " + Math.Round(ev.windDirection) + "° at " + Math.Round(ev.windSpeed) + " kt");
            mainNode.Nodes.Add("Pressure: " + Math.Round(ev.pressure) + " / altimeter set:  " + ev.altimeterSetting);
            mainNode.Nodes.Add("Fuel: " + Math.Round(ev.fuel) + " / Gross weight: " + Math.Round(ev.grossWeight));
            mainNode.Nodes.Add("Pitch: " + Math.Round(ev.pitch) + " / Bank: " + Math.Round(ev.bank));
            mainNode.Nodes.Add("Distance flown: " + Math.Round(ev.distance));
            mainNode.Nodes.Add("Flaps " + ev.flaps);
            mainNode.Nodes.Add("Gear " + ev.gear);
        }
示例#2
0
        private void SendDivertReport()
        {
            string icao = divertAirportCombo.Text;

            if (icao == "")
            {
                MessageBox.Show("You must enter ICAO of the airport you diverted to");
                return;
            }
            string comment = this.reasonTxt.Text;

            if (comment == "")
            {
                MessageBox.Show("You must enter the reason for divert");
                return;
            }

            FlightEvent blockOn          = FlightTracking.GetFlightEvent("BlockOn");
            TimeSpan    duration         = AcarsBuilder.duration;
            string      durationString   = duration.Hours.ToString("00") + ":" + duration.Minutes.ToString("00") + ":" + duration.Seconds.ToString("00");
            bool        sendDivertResult = Connector.SendDivertReport(icao, comment, pirepId, blockOn.latitude, blockOn.longitude, durationString);

            if (sendDivertResult)
            {
                MessageBox.Show("Divert report has been sent. It is safe to close Šemík now.");
                this.Close();
            }
            else
            {
                MessageBox.Show("Divert report has not been sent. You can try again or see log for details of the error. Contact support if the problem continues.");
            }
        }
示例#3
0
        private void ShowDivert()
        {
            this.tabControl.TabPages.Add(this.tabDivert);
            this.tabControl.SelectedTab = this.tabDivert;
            string message = "It appears you have not landed on destination airport " + FlightTracking.flightInit.arrival + ".\n";

            message += "You can create a divert report here to complete the divert. The report will be sent to the airline staff to approve. Once approved, the flight be logged as diverted, allowing you to continue from the airport, to which you have diverted.";
            this.divertMessageTxt.Text = message;
            FlightEvent blockOn      = FlightTracking.GetFlightEvent("BlockOn");
            XmlNodeList airports     = Connector.GetNearestAirport(blockOn.latitude, blockOn.longitude);
            string      errorMessage = "It appears you didn`t land on an airport at all. You can still submit a report, but in the text be more specific about what had happened during your flight.";

            if (airports == null)
            {
                MessageBox.Show(errorMessage);
            }
            else
            {
                if (airports.Count > 0)
                {
                    this.divertAirportCombo.Items.Clear();
                    for (int i = 0; i < airports.Count; i++)
                    {
                        XmlElement airport = (XmlElement)airports[i];
                        this.divertAirportCombo.Items.Add(airport.GetAttribute("icao"));
                    }
                    this.divertAirportCombo.SelectedItem = this.divertAirportCombo.Items[0];
                }
                else
                {
                    MessageBox.Show(errorMessage);
                }
            }
        }
示例#4
0
        public void addEvent(FlightEvent ev)
        {
            int n = eventsGrid.Rows.Add();

            this.eventsGrid.Rows[n].Cells[0].Value = ev.GetUTCTimeString();
            this.eventsGrid.Rows[n].Cells[1].Value = ev.id;
            this.eventsGrid.Rows[n].Cells[2].Value = Math.Round(ev.altitude);
            this.eventsGrid.Rows[n].Cells[3].Value = Math.Round(ev.groundSpeed);
            this.eventsGrid.Rows[n].Cells[4].Value = Math.Round(ev.fuel);
            this.eventsGrid.Rows[n].Cells[5].Value = Math.Round(ev.distance);
            this.eventsGrid.Rows[n].Cells[6].Value = ev.remarks;

            addTreeItem(ev);
        }
示例#5
0
        private void ftrTree_NodeDoubleClick(object sender, TreeNodeMouseClickEventArgs e)
        {
            string name = "";

            name = e.Node.Name;
            if (name != "")
            {
                FlightEvent fe = GetFlightEvent(name);
                if (fe != null)
                {
                    string caption = fe.GetUTCTimeString() + " / " + fe.id;
                    mainForm.ShowImage(fe.image, caption);
                }
            }
        }
示例#6
0
        public void Start(int seconds, FlightEvent trackEvent)
        {
            aTimer = new System.Timers.Timer
            {
                Interval = seconds
            };

            _trackEvent = trackEvent;

            aTimer.Elapsed += TimerElapsed;

            //Only run once
            aTimer.AutoReset = false;

            aTimer.Enabled = true;

            //Console.WriteLine("Timer has starteed");
        }
示例#7
0
        public Flight(FlightPhases initialPhase = FlightPhases.PREFLIGHT)
        {
            #region Register Events
            activeEvents = new FlightEvent[] {
                new FlightEvent("2A", 5, "Bank Angle Exceeded", 30, 30, (t) => { return(t.Bank > 30); }),
                new FlightEvent("3A", 5, "Landing lights on above 10000 ft", 5, 5, (t) => { return(t.LandingLights && (t.Altitude > 10500)); }),
                new FlightEvent("3B", 5, "Landing lights off durring approach", 5, 5, (t) => { return(!t.LandingLights && (t.RadioAltitude < 2750 || t.Altitude < 2500) && phase == FlightPhases.APPROACH); }),
                new FlightEvent("3C", 5, "Speed above 250 IAS bellow 10000 ft", 10, 10, (t) => { return((t.IndicatedAirSpeed > 255) && (t.Altitude < 9500)); }),
                new FlightEvent("3D", 5, "High Speed On Taxi Out", 5, 5, (t) => { return((t.GroundSpeed > 30 && t.OnGround) && phase == FlightPhases.TAXIOUT); }),
                new FlightEvent("3E", 5, "High Speed On Taxi In", 5, 5, (t) => { return((t.GroundSpeed > 30 && t.OnGround) && phase == FlightPhases.TAXIIN); }),
                new FlightEvent("4A", 5, "Landing light on above 250 IAS", 5, 5, (t) => { return(t.LandingLights && t.IndicatedAirSpeed > 255); }),
                new FlightEvent("4B", 5, "Landing lights Off On TakeOff", 5, 5, (t) => { return(!t.LandingLights && phase == FlightPhases.TAKEOFF); }),
                new FlightEvent("4C", 5, "Pitch High Below 1500ft on Departure(Radio)", 10, 10, (t) => { return((t.RadioAltitude < 1500) && t.Pitch > 20); }),
                new FlightEvent("4D", 5, "Gear down above 250 IAS", 10, 30, (t) => { return(t.Gear && t.IndicatedAirSpeed > 255); }),
                new FlightEvent("6A", 1, "Maximum TakeOff Weight Excceded", 30, 30, (t) => { return(phase == FlightPhases.TAKEOFF && (t.GrossWeight > LoadedFlightPlan.Aircraft.MTW)); }),
                new FlightEvent("6B", 1, "Maximum Landing Weight Excceded", 30, 30, (t) => { return(phase == FlightPhases.LANDING && (t.GrossWeight > LoadedFlightPlan.Aircraft.MLW)); }),
                new FlightEvent("6C", 1, "Maximum Service Ceiling Excceded", 30, 30, (t) => { return(!t.OnGround && (t.Altitude > LoadedFlightPlan.Aircraft.Celling)); }),
                //new FlightEvent("6D", 1, "Maximum Speed Flap Excceded"             , 30, 30, (t) => {
                //    var flapSetting = LoadedFlightPlan.Aircraft.FlapSettings.OrderBy(x => x.Key).Where(x => x.Key < t.Flaps).FirstOrDefault().Value;
                //    return (!t.OnGround && (t.IndicatedAirSpeed > flapSetting.IASLimit));
                //}),

                new FlightEvent("6D", 1, "Maximum Speed Flap Excceded", 30, 30, (t) => { return(LoadedFlightPlan.Aircraft.FlapSettings.ContainsKey(t.Flaps) && (LoadedFlightPlan.Aircraft.FlapSettings[t.Flaps].IASLimit < t.IndicatedAirSpeed)); }),
                new FlightEvent("7B", 5, "Pitch too high", 30, 30, (t) => { return(t.Pitch > 30); })
            };
            #endregion Register Events

            phase         = initialPhase;
            FlightRunning = false;

            TelemetryLog = new List <Telemetry>();

            ActualArrivalTimeId   = -1;
            ActualDepartureTimeId = -1;

            LoadedFlightPlan = null;

            FinalScore = 100;

            Events = new List <EventOccurrence>();
        }
示例#8
0
        public ChecklistViewModel(FlightEvent flightEvent, bool connectedToDiscord)
        {
            Name          = flightEvent.Name;
            StartDateTime = flightEvent.StartDateTime;
            EndDateTime   = flightEvent.EndDateTime;

            if (flightEvent.ChecklistItems != null)
            {
                foreach (var item in flightEvent.ChecklistItems)
                {
                    var itemVM = new ChecklistItemViewModel(item)
                    {
                        Title = item.Title,
                        Links = item.Links
                    };
                    switch (item.Type)
                    {
                    case FlightEventChecklistItemType.Client:
                        switch (item.SubType)
                        {
                        case FlightEventChecklistItemSubType.ConnectToDiscord:
                            itemVM.IsChecked = connectedToDiscord;
                            itemVM.IsEnabled = false;
                            itemVM.Hint      = "To connect Flight Events to Discord:\n- Open Discord tab\n- Click Connect\n- Login to your Discord account\n- Authorize Flight Events bot to get your Discord information\n- Copy the Code back to this client\n- Press Confirm";
                            break;
                        }
                        Items.Add(itemVM);
                        break;

                    default:
                        Items.Add(itemVM);
                        break;
                    }
                }
            }
        }
示例#9
0
 protected virtual void OnFlightEvent(Flight flight)
 {
     FlightEvent?.Invoke(this, new FlightEventArgs {
         Flight = flight
     });
 }
示例#10
0
 public EventOccurrence(int StartId, int EndId, FlightEvent Event)
 {
     this.StartId = StartId;
     this.EndID   = EndID;
     this.Event   = Event;
 }