Example #1
0
        private void InitData()
        {
            // Aircraft data
            profiles = new ProfileCollection();
            var err = profiles.Initialize().ToList();

            if (err.Count > 0)
            {
                this.ShowWarning(string.Join("\n", err), "Performance file loading warning");
            }

            try
            {
                // Load options.
                var o = OptionManager.ReadOrCreateFile();

                appOptionsLocator = new Locator <AppOptions>()
                {
                    Instance = OptionManager.TryDetectSimulatorPathsAndSave(o)
                };
            }
            catch (Exception ex)
            {
                Log(ex);
                this.ShowError("Cannot load options. The application will quit now.");
                Environment.Exit(1);
            }

            try
            {
                InitAirportAndWaypoints();
            }
            catch (Exception ex)
            {
                Log(ex);
                failedToLoadNavDataAtStartUp = true;

                countryCodesLocator = new Locator <CountryCodeManager>(null);
                airwayNetwork       = new AirwayNetwork(
                    new DefaultWaypointList(), new DefaultAirportManager(),
                    new MultiMap <string, Navaid>());
            }

            procFilter       = new ProcedureFilter();
            windTableLocator = new Locator <IWxTableCollection>()
            {
                Instance = new DefaultWxTableCollection()
            };
            updater = new Updater();
        }