// Fill the list with GetEvent() data: MySeance Event become EventCell and there are grouped in EventCellGroup for each day private void FillMySeanceList() { var MySeanceList = new List <EventCellGroup>(); var CurrentEventCellGroup = new EventCellGroup() { Title = "Aucune inscription" }; foreach (var Event in MySeances) { if (Event.Date.Date.ToString("dddd d MMMM") != CurrentEventCellGroup.Title) { if (CurrentEventCellGroup.Count != 0) { MySeanceList.Add(CurrentEventCellGroup); } CurrentEventCellGroup = new EventCellGroup() { Title = Event.Date.Date.ToString("dddd d MMMM") }; } ImageSource ImageSource; if (Event.Type_ID == 1) { ImageSource = "Musculation.png"; } else if (Event.Type_ID == 2) { ImageSource = "Fitness.png"; } else { ImageSource = "Exterieur.png"; } CurrentEventCellGroup.Add(new EventCell() { ID = Event.ID, Name = Event.Name, Description = Event.Description, Coach = Event.Surname, Time = Event.Date.ToString("HH:mm"), PlaceStatus = Color.FromHex("#4169E1"), TypePicture = ImageSource, Owner_ID = Event.Owner_ID }); } MySeanceList.Add(CurrentEventCellGroup); MySeanceListView.ItemsSource = MySeanceList; }
// Fill the list with GetEvent() data: History Event become EventCell and there are grouped in EventCellGroup for each day private void FillHistoryList() { var HistoryList = new List <EventCellGroup>(); var CurrentEventCellGroup = new EventCellGroup() { Title = "Aucun historique" }; foreach (var Event in History) { if (Event.Date.Date.ToString("dddd d MMMM") != CurrentEventCellGroup.Title) { if (CurrentEventCellGroup.Count != 0) { HistoryList.Add(CurrentEventCellGroup); } CurrentEventCellGroup = new EventCellGroup() { Title = Event.Date.Date.ToString("dddd d MMMM") }; } ImageSource ImageSource; if (Event.Type_ID == 1) { ImageSource = "Musculation.png"; } else if (Event.Type_ID == 2) { ImageSource = "Fitness.png"; } else { ImageSource = "Exterieur.png"; } CurrentEventCellGroup.Add(new EventCell() { ID = Event.ID, Name = Event.Name, Description = Event.Description, Coach = Event.Surname, Time = Event.Date.ToString("HH:mm"), PlaceStatus = Color.Gray, TypePicture = ImageSource, Owner_ID = Event.Owner_ID }); } HistoryList.Add(CurrentEventCellGroup); HistoryListView.ItemsSource = HistoryList; }
// Fill the list with GetEvent() data: Event become EventCell and there are grouped in EventCellGroup for each day private void FillEventList() { var EventList = new List <EventCellGroup>(); var CurrentEventCellGroup = new EventCellGroup() { Title = "Aucun événement" }; foreach (var Event in Events) { if (Event.Date.Date.ToString("dddd d MMMM") != CurrentEventCellGroup.Title) { if (CurrentEventCellGroup.Count != 0) { EventList.Add(CurrentEventCellGroup); } CurrentEventCellGroup = new EventCellGroup() { Title = Event.Date.Date.ToString("dddd d MMMM") }; } Color StatusColor; ImageSource ImageSource; if (MySeances.Exists(p => p.ID == Event.ID)) { StatusColor = Color.FromHex("#4169E1"); } else if (Event.Place == 0) { StatusColor = Color.Red; } else if (Event.Place <= 3) { StatusColor = Color.Orange; } else { StatusColor = Color.LimeGreen; } if (Event.Type_ID == 1) { ImageSource = "Musculation.png"; } else if (Event.Type_ID == 2) { ImageSource = "Fitness.png"; } else { ImageSource = "Exterieur.png"; } CurrentEventCellGroup.Add(new EventCell() { ID = Event.ID, Name = Event.Name, Description = Event.Description, Coach = Event.Surname, Time = Event.Date.ToString("HH:mm"), PlaceStatus = StatusColor, TypePicture = ImageSource, Owner_ID = Event.Owner_ID }); } EventList.Add(CurrentEventCellGroup); EventListView.ItemsSource = EventList; }