public void Search() { SearchLatLngDataSource DataSource = new SearchLatLngDataSource(); using (var csv = new CsvReader(new StreamReader(Util.root + "/system/addr.csv"))) { var config = csv.Configuration; config.HasHeaderRecord = true; // ヘッダーが存在する場合 true config.RegisterClassMap <LatLngTable>(); var list = csv.GetRecords <LatLng>(); Result.AllowsColumnSelection = true; foreach (var n in list) { if (Regex.IsMatch(n.place, Place.StringValue)) { DataSource.dataList.Add(new SearchLatLngData() { place = n.place, lat = n.lat, lng = n.lng }); } // Console.WriteLine($"{n.place}, {n.lat}, {n.lng}"); } } Result.DataSource = DataSource; Result.Delegate = new SearchLatLngDelegate(DataSource); Result.ReloadData(); }
partial void LatLngTableClicked(NSObject sender) { int row = (int)Result.SelectedRow; if (row >= 0) { SearchLatLngDataSource data = (SearchLatLngDataSource)Result.DataSource; selectedPlace = data.dataList[row].place; selectedLat = data.dataList[row].lat; selectedLng = data.dataList[row].lng; } }