コード例 #1
0
ファイル: Main.cs プロジェクト: sergeybe/geoloader
        private void ddlCountry_SelectedIndexChanged(object sender, EventArgs e)
        {
            var countryId = FindCountryIdByName(countries, ddlCountry.SelectedItem.ToString());

            ddlRegion.Items.Clear();
            if (countryId == -1)
            {
                var dialog = new OpenFileDialog {
                    Title = "Выберите wpt файл", Filter = "wpt files (*.wpt)|*.wpt", RestoreDirectory = true
                };
                if (dialog.ShowDialog() == DialogResult.OK)
                {
                    var wptLister = new WptListLoader();
                    caches             = wptLister.List(dialog.FileName);
                    wptName            = Path.GetFileNameWithoutExtension(dialog.FileName);
                    btnSaveGpx.Enabled = true;
                    btnSavePoi.Enabled = true;
                    //btnSave_Click(sender, e);
                }
            }
            else
            {
                var loader = new RegionLoader();
                regions = loader.List(countryId);
                foreach (var region in regions)
                {
                    ddlRegion.Items.Add(region.Name);
                }
            }
        }
コード例 #2
0
        /// <exception cref="Exception"></exception>
        private void InitAirportAndWaypoints()
        {
            string navDataPath    = AppSettings.NavDataLocation;
            var    airportTxtPath = Path.Combine(navDataPath, "Airports.txt");

            var airportResult = AirportDataLoader.LoadFromFile(airportTxtPath);
            var err           = airportResult.Errors;

            if (err.Any())
            {
                Log(ReadFileErrorMsg.ErrorMsg(err, "ats.txt"));
            }
            var airports = airportResult.Airports;

            var result = new WptListLoader(navDataPath).LoadFromFile();

            countryCodesLocator = result.CountryCodes.ToLocator();
            airwayNetwork       = new AirwayNetwork(result.WptList, airports);
        }
コード例 #3
0
 // If failed, returns null.
 private WaypointList TryLoadWpts()
 {
     try
     {
         var loader = new WptListLoader(pathTxtBox.Text);
         var result = loader.LoadFromFile();
         countryCodesLocator.Instance = result.CountryCodes;
         return(result.WptList);
     }
     catch (WaypointFileReadException ex)
     {
         Log(ex);
         this.ShowError(ex.Message);
         return(null);
     }
     catch (LoadCountryNamesException ex)
     {
         Log(ex);
         this.ShowError("Failed to load icao_nationality_code.txt.");
         return(null);
     }
 }