示例#1
0
        private void BtnArrAdd_Click(object sender, EventArgs e)
        {
            string strCallsign = TxtArr.Text;

            Airport apArr = Airport.FindICAO(TxtArr.Text);

            if (apArr != null)
            {
                if (FilterSettings.listDep.Contains(apArr))
                {
                    MessageBox.Show(apArr.strICAO + " is already in the list.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    cbArr.SelectedIndex = cbArr.Items.IndexOf(strCallsign);
                }
                else
                {
                    FilterSettings.listArr.Add(apArr);
                    cbArr.Items.Add(new ComboBoxItem(apArr.strName, apArr));
                    cbArr.SelectedIndex = cbArr.Items.Count - 1;
                }
            }
            else
            {
                MessageBox.Show("Airport ICAO code not found.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#2
0
        private void BtnSearch_Click(object sender, EventArgs e)
        {
            tlpRunways.Controls.Clear();
            tlpRunways.RowCount = 0;

            if (TxtSearch.Text != "")
            {
                apCurrent = Airport.FindICAO(TxtSearch.Text);
                if (apCurrent == null)
                {
                    MessageBox.Show("Airport not found.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else
                {
                    int intSize = tlpRunways.Height;
                    listActive = new List <Runway>(apCurrent.listRunways);

                    foreach (Runway rwyRwy in apCurrent.listRunways)
                    {
                        if (rwyRwy != null)
                        {
                            tlpRunways.RowStyles.Add(new RowStyle(SizeType.Absolute, 23));

                            //
                            // LblRunway
                            //
                            Label LblRunway = new Label();
                            LblRunway.ForeColor = cp.Text;
                            tlpRunways.Controls.Add(LblRunway, 0, tlpRunways.RowCount - 1);
                            LblRunway.AutoSize  = true;
                            LblRunway.Dock      = DockStyle.Fill;
                            LblRunway.Location  = new Point(3, 0);
                            LblRunway.Name      = "LblRunway";
                            LblRunway.Size      = new Size(35, 23);
                            LblRunway.Text      = rwyRwy.strRunway;
                            LblRunway.TextAlign = ContentAlignment.MiddleRight;

                            //
                            // chkActive
                            //
                            CheckBox chkActive = new CheckBox();
                            chkActive.BackColor = cp.Window;
                            chkActive.ForeColor = cp.Text;
                            tlpRunways.Controls.Add(chkActive, 1, tlpRunways.RowCount - 1);
                            chkActive.AutoSize = true;
                            chkActive.Dock     = DockStyle.Fill;
                            chkActive.Location = new Point(201, 3);
                            chkActive.Name     = "chkActive";
                            chkActive.Size     = new Size(15, 13);
                            chkActive.UseVisualStyleBackColor = true;
                            chkActive.Tag = rwyRwy;

                            if (apCurrent.listActive.Contains(rwyRwy))
                            {
                                chkActive.Checked = true;
                            }

                            tlpRunways.RowCount++;
                        }
                    }
                }
            }
            else
            {
                MessageBox.Show("Please enter an ICAO airport code.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
示例#3
0
        public FPlan(string[] _data) : base(_data)
        {
            strAircraft = _data[9];

            if (decimal.TryParse(_data[10], NumberStyles.Float, DataLink.DataCulture, out decimal decTemp))
            {
                decTASCruise = decTemp;
            }
            else
            {
                decTASCruise = 0;
            }

            apDep = Airport.FindICAO(_data[11]);
            apArr = Airport.FindICAO(_data[13]);
            apAlt = Airport.FindICAO(_data[28]);

            if (int.TryParse(_data[12], NumberStyles.Integer, DataLink.DataCulture, out int intTemp))
            {
                intPlanAlt = intTemp;
            }
            else
            {
                try
                {
                    _data[12] = _data[12].Substring(1);
                    if (int.TryParse(_data[12], NumberStyles.Integer, DataLink.DataCulture, out intTemp))
                    {
                        intPlanAlt = intTemp;
                    }
                    else
                    {
                        intPlanAlt = 0;
                    }
                }
                catch
                {
                    intPlanAlt = 0;
                }
            }

            if (intPlanAlt.ToString().Length < 4)
            {
                intPlanAlt *= 100;
            }

            strRevision = _data[20];
            strRules    = _data[21];

            try
            {
                dtDep = new DateTime(1, 1, 1, int.Parse(_data[22].Substring(0, 2), DataLink.DataCulture), int.Parse(_data[22].Substring(2, 2), DataLink.DataCulture), 0);
            }
            catch
            {
                dtDep = default(DateTime);
            }

            try
            {
                tspEnroute = new TimeSpan(int.Parse(_data[24], DataLink.DataCulture), int.Parse(_data[25], DataLink.DataCulture), 0);
            }
            catch
            {
                tspEnroute = default(TimeSpan);
            }

            try
            {
                tspFuel = new TimeSpan(int.Parse(_data[26], DataLink.DataCulture), int.Parse(_data[27], DataLink.DataCulture), 0);
            }
            catch
            {
                tspFuel = default(TimeSpan);
            }

            strRoute   = _data[30];
            strRemarks = _data[29];
        }