private void ToolkitListPicker_OnSelectionChanged(object sender, SelectionChangedEventArgs e) { ParkingCity pc = ToolkitListPicker.SelectedItem as ParkingCity; if (pc == null) { return; } if (pc.Id == 0) { return; } CarParkList.ItemsSource = null; SetProgressIndicator(true); SystemTray.ProgressIndicator.Text = "Loading Car Parks"; GetCarParks(pc.Id, pc.Name); }
public List <ParkingCity> GetCities() { var cities = new List <ParkingCity>(); try { _connection = new MySqlConnection(ConnectionString); _connection.Open(); var sql = string.Format("SELECT * from Roadwatch_Parking_City "); using (var cmd = new MySqlCommand(sql, _connection)) { using (var r = cmd.ExecuteReader()) { while (r.Read()) { var city = new ParkingCity { Id = r.GetInt32("Id"), Name = r.GetString("Name") }; cities.Add(city); } } } } catch (Exception ex) { var sf = new StackFrame(); var methodBase = sf.GetMethod(); Database.InsertRoadwatchErrorToDb(methodBase.Name, ex.Message, ex.ToString()); } return(cities); }