private async void FillListViews() { List <Unit> units = await SaveAndLoad.LoadUnits(); List <SportType> sports = await SaveAndLoad.LoadSports(); // TO DO : Binding Data units to ListView lis_units.ItemsSource = units; lis_sports.ItemsSource = sports; }
private async void FillPickers(Session old) { List <Unit> units = await SaveAndLoad.LoadUnits(); pic_unit.ItemsSource = units; List <SportType> sports = await SaveAndLoad.LoadSports(); pic_sportType.ItemsSource = sports; CheckOld(old); }
private async void FillListViews() { lis_units.Children.Clear(); List <Unit> units = await SaveAndLoad.LoadUnits(); foreach (Unit unit in units) { Button btn = new Button(); btn.Text = unit.ToStringBtn(); btn.Clicked += delegate { Button_SelectedUnit(btn); }; if (units_id.IndexOf(unit.Id) != -1) { btn.BackgroundColor = Color.FromRgba(220, 120, 220, 120); } lis_units.Children.Add(btn); } }
private void Button_ReloadUnit(object sender, EventArgs e) { SaveAndLoad.LoadUnits(true); }
/// <summary> /// Displays the units that are linked to the selected sport type in pic_unit /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private async void Picker_SelectSport(object sender, EventArgs e) { try { if (pic_sportType.SelectedItem != null) { SportType sport = (SportType)pic_sportType.SelectedItem; List <Unit> units = await SaveAndLoad.LoadUnits(); if (units != null) { List <Unit> newUnits = new List <Unit>(); foreach (Unit unit in units) { if (sport.Units.Contains(unit.Id)) { newUnits.Add(unit); } } if (newUnits.Count != 0) { pic_unit.ItemsSource = newUnits; } } List <Session> sessions = await SaveAndLoad.LoadSessions(); if (sessions != null) { List <Session> newSessions = new List <Session>(); foreach (Session ss in sessions) { if (ss.GetSportType().Id == sport.Id) { newSessions.Add(ss); } } if (newSessions != null) { lis_sessions.ItemsSource = newSessions; lis_sessions.ItemSelected += ListSession_ItemSelec; } } } else { List <Unit> units = await SaveAndLoad.LoadUnits(); if (units != null) { pic_unit.ItemsSource = units; } List <Session> sessions = await SaveAndLoad.LoadSessions(); if (sessions != null) { lis_sessions.ItemsSource = sessions; } } } catch (Exception ex) { DependencyService.Get <IMessage>().longtime("ERROR: " + ex.Message); } }