public SetupWindow() { InitializeComponent(); arrivalView.BackColor = Colours.GetColour(Colours.Identities.WindowBackgound); arrivalView.ForeColor = Colours.GetColour(Colours.Identities.InteractiveText); departureView.BackColor = Colours.GetColour(Colours.Identities.WindowBackgound); departureView.ForeColor = Colours.GetColour(Colours.Identities.InteractiveText); // Retrieve Properties Information //https://www.daveoncsharp.com/2009/07/using-the-settings-file-in-csharp/ t_vStripsHostIP.Text = Properties.Settings.Default.vStripsHost; if (vStripsConnector.Airport != null) { airportLabel.Enabled = true; airportLabel.Text = vStripsConnector.Airport.ICAOName; var rwys = Airspace2.GetRunways(vStripsConnector.Airport.ICAOName); if (rwys != null) { string[] split = vStripsConnector.Runways.Split(':'); string[] arwys = split[0].Split('/'); string[] drwys = split[1].Split('/'); foreach (var rwy in rwys.Select(r => r.Name).OrderBy(n => n)) { var anode = arrivalView.Nodes.Add(rwy); if (arwys.Contains(rwy)) { anode.Checked = true; } var dnode = departureView.Nodes.Add(rwy); if (drwys.Contains(rwy)) { dnode.Checked = true; } } arrivalView.Enabled = true; departureView.Enabled = true; } } }
private void ProcessData(string packet) { if (packet.Length == 0) { return; } string msg = packet.Substring(1); string[] msg_fields = msg.Split(':'); FDP2.FDR fdr = null; if (msg_fields.Length > 0) { fdr = FDP2.GetFDRs.FirstOrDefault(f => f.Callsign == msg_fields[0]); } switch (packet[0]) { case 'U': if (!connected) { OnConnected(); } SendControllerInfo(); break; case 'r': // Runway request if (Airport?.ICAOName != msg) // || setRunways == false) // Commented out as part of runway supression { getMetar(msg); // Call before we update 'Airport' Airport = Airspace2.GetAirport(msg); setRunways = false; //vStripsPlugin.ShowSetupWindow(); // Commented out to stop popup JMG } else { //SendRunways(); Airport = Airspace2.GetAirport(msg); } break; case 'S': // State if (msg_fields.Length > 1 && fdr != null) { switch (msg_fields[1]) { case "TAXI": MMI.EstFDR(fdr); break; } } break; /* * JMG * vStrips doesn't send Arrival Runway, so we use Dep runway in vStrips for Arrival runway allocation. * We need to keep an eye out when Route changes received that have a Dep runway and reassign to Arr runway. * */ case 'R': // Route if (msg_fields.Length > 3 && fdr != null) { if (fdr.DepAirport == msg_fields[1] && fdr.DesAirport == msg_fields[2]) { string rte = msg_fields[3]; string[] rte_fields = rte.Split(' '); // parse route on space if (rte_fields[0].Contains('/')) // If the first field has a slash, it's a Dep runway assignment. { string[] start_fields = rte_fields[0].Split('/'); String NewRwy = start_fields[1]; // get the runway if (fdr.CoupledTrack?.OnGround == false) // if we're airborne apply the runway to Arrivals { FDP2.SetArrivalRunway(fdr, Airspace2.GetRunway(fdr.DesAirport, NewRwy)); } else // Apply the Route change, or Dep runway change { string temprwy = ""; if (fdr.DepartureRunway != null) { temprwy = fdr.DepartureRunway.ToString(); } if (temprwy != NewRwy) // if the Dep runway has changed { FDP2.SetDepartureRunway(fdr, Airspace2.GetRunway(fdr.DepAirport, NewRwy)); } else // Not a runway change, so update the route { FDP2.ModifyRoute(fdr, rte); } } } } else { FDP2.ModifyFDR(fdr, fdr.Callsign, fdr.FlightRules, msg_fields[1], msg_fields[2], msg_fields[3], fdr.Remarks, fdr.AircraftCount.ToString(), fdr.AircraftType, fdr.AircraftWake, fdr.AircraftEquip, fdr.AircraftSurvEquip, fdr.TAS.ToString(), fdr.RFL.ToString(), fdr.ETD.ToString("HHmm"), fdr.EET.ToString("HHmm")); } } break; case 'H': // Heading if (msg_fields.Length > 1 && fdr != null) { vStripsAssignedHeadings.AddOrUpdate(fdr.Callsign, int.Parse(msg_fields[1]), (s, i) => int.Parse(msg_fields[1])); if (!string.IsNullOrEmpty(msg_fields[1]) && msg_fields[1] != "0") { FDP2.SetGlobalOps(fdr, $"H{msg_fields[1]}"); } if (msg_fields.Length > 2 && msg_fields[2] != "0") { FDP2.SetCFL(fdr, FDP2.FDR.LEVEL_NONE, int.Parse(msg_fields[2]), false); } } break; case '>': // Select Callsign // Edited JMG to ensure when strip is selected in vStrips, track is selected in vatSys if (fdr != null) { var currentSelection = MMI.SelectedTrack; // Deselect old if (MMI.SelectedTrack != null) { MMI.SelectOrDeselectTrack(currentSelection); } var trk = MMI.FindTrack(fdr); if (trk != null) { MMI.SelectOrDeselectTrack(trk); } } break; } PacketReceived?.Invoke(this, new PacketReceivedEventArgs(packet)); Console.WriteLine(packet); }