public async void LoadLists() { sessions = await SaveAndLoad.LoadSessions(); SetChartDayRepart(); SetChartWeekRepart(); SetChartFavSport(); }
/// <summary> /// /// </summary> private async void FillListView() { sessions = await SaveAndLoad.LoadSessions(); if (sessions == null) { DependencyService.Get <IMessage>().longtime("list of sessions is null"); } lis_sessions.ItemsSource = sessions; lis_sessions.ItemSelected += ListItem_Selected; lis_sessions.SelectedItem = null; SetChart(); }
/// <summary> /// sorts the sessions by date /// keep only the sessions scheduled on the same week as day /// </summary> /// <param name="day">one day of the wanted week</param> private async void FillList(DateTime day) { lab_week.Text = "Sessions of the Week #" + GetIso8601WeekOfYear(day); List <Session> sessions = await SaveAndLoad.LoadSessions(); List <Session> weekSessions = new List <Session>(); foreach (Session s in sessions) { if (GetIso8601WeekOfYear(s.SDate) == GetIso8601WeekOfYear(day)) { weekSessions.Add(s); } } lis_sessions.ItemsSource = weekSessions; FillChart(weekSessions, day); }
private void Button_ReloadSession(object sender, EventArgs e) { SaveAndLoad.LoadSessions(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); } }