Exemplo n.º 1
0
        private bool IsGliderDualSeater(String glider)
        {
            string      prefix   = glider.ToLower();
            Displayable matching = null;

            if (prefix.Length > 1)
            {
                foreach (Displayable s in Csv.GlidersList)
                {
                    if (s.DisplayName.ToLower().StartsWith(prefix))
                    {
                        matching = s;
                        break;
                    }
                }
            }
            if (matching != null)
            {
                string key = matching.Key;
                if (key != null && Csv.AircraftDict.ContainsKey(key))
                {
                    return(Csv.AircraftDict[key].Seats != 1);
                }
            }
            return(true);
        }
Exemplo n.º 2
0
        List <Displayable> LoadAirfieldList()
        {
            List <Displayable> final = new List <Displayable>();
            // Commented out because I prefer to have Bacchus Marsh be the default
            //final.Add(new Displayable() { DisplayName = DropdownHelp, RealName = "" });
            FileHelperEngine <Airfield> engine = new FileHelperEngine <Airfield>();

            engine.ErrorManager.ErrorMode = ErrorMode.SaveAndContinue;
            string fn = FlightSheetsFolder + "/airfields.csv";

            if (!File.Exists(fn))
            {
                MainForm.Fatal("Could not find file: " + fn);
            }
            var res = engine.ReadFile(fn);

            if (engine.ErrorManager.ErrorCount > 0)
            {
                engine.ErrorManager.SaveErrors("Errors.txt");
            }
            foreach (Airfield airfield in res)
            {
                Displayable d = new Displayable();
                d.DisplayName = d.RealName = airfield.Name;
                final.Add(d);
            }
            return(final);
        }
Exemplo n.º 3
0
        List <Displayable> LoadAircraftList(bool tug)
        {
            List <Displayable> final = new List <Displayable>();

            final.Add(new Displayable()
            {
                DisplayName = DropdownHelp, RealName = ""
            });
            foreach (Aircraft aircraft in AircraftDict.Values)
            {
                string actype   = aircraft.Type.ToLower();
                bool   isTug    = (actype == "t" || actype == "m" || actype == "w");
                bool   isGlider = (actype == "g" || actype == "m");
                if (tug && isTug || !tug && isGlider)
                {
                    string      name = aircraft.Reg + " " + aircraft.Name + ClubSuffix(aircraft.Club);
                    Displayable d    = new Displayable();
                    d.DisplayName = d.RealName = name;
                    d.Key         = aircraft.Reg;
                    final.Add(d);
                    if (aircraft.Name != "")
                    {
                        d             = new Displayable();
                        d.DisplayName = aircraft.Name + " " + aircraft.Reg + ClubSuffix(aircraft.Club);
                        d.RealName    = name;
                        d.Key         = aircraft.Reg;
                        final.Add(d);
                    }
                }
            }
            final.Sort(CompareDisplays);
            return(final);
        }
Exemplo n.º 4
0
        // Sort alphabetically but put the club's own entries first
        int CompareDisplays(Displayable a, Displayable b)
        {
            bool aclub = a.DisplayName.Contains("[");
            bool bclub = b.DisplayName.Contains("[");

            if (aclub ^ bclub)
            {
                return(aclub ? 1 : -1);
            }
            else
            {
                return(string.Compare(a.DisplayName, b.DisplayName));
            }
        }
Exemplo n.º 5
0
        public List <Displayable> LoadAefTypes()
        {
            List <Displayable> final = new List <Displayable>();

            foreach (AefType aefType in AefTypeDict.Values)
            {
                var d = new Displayable();
                d.DisplayName = aefType.Name;
                d.RealName    = aefType.Code + " " + aefType.Name;
                d.Key         = aefType.Code;
                final.Add(d);
            }
            return(final);
        }
Exemplo n.º 6
0
        public List <Displayable> LoadPilotsList(bool isMember = false, bool isL2 = false)
        {
            string             help  = isL2 ? DropdownHelpDutyInst : DropdownHelp;
            List <Displayable> final = new List <Displayable>();

            final.Add(new Displayable()
            {
                DisplayName = help, RealName = ""
            });
            foreach (Pilot pilot in PilotDict.Values)
            {
                if (isMember && pilot.Club.ToLower() != CLubInitials.ToLower())
                {
                    continue;
                }
                if (isL2 && !DutyLevels.Contains(pilot.Rating.ToLower()))
                {
                    continue;
                }
                string name = pilot.LastName;
                if (pilot.FirstName != "")
                {
                    name += ", " + pilot.FirstName;
                }
                name += ClubSuffix(pilot.Club);
                Displayable d = new Displayable();
                d.DisplayName = name;
                d.RealName    = name;
                d.Key         = pilot.ID;
                final.Add(d);
                if (pilot.FirstName != "")
                {
                    d             = new Displayable();
                    d.DisplayName = pilot.FirstName + " " + pilot.LastName + ClubSuffix(pilot.Club);
                    d.RealName    = name;
                    d.Key         = pilot.ID;
                    final.Add(d);
                }
            }
            final.Sort(CompareDisplays);
            return(final);
        }