- public void InitializeInterface()
- {
- try
- {
- var layout = new StackLayout() { Spacing = 0 };
- ScrollView clientscroll = new ScrollView
- {
- Padding = new Thickness(0, 10, 15, 10),
- HeightRequest = 50,
- WidthRequest = 50,
- Orientation = ScrollOrientation.Vertical,
- VerticalOptions = LayoutOptions.Fill,
- HorizontalOptions = LayoutOptions.Fill,
- Content = new StackLayout
- {
- Orientation = StackOrientation.Vertical,
- Children = { layout }
- }
- };
- Content = clientscroll;
- for (int i = 0; i < scheduleData.schedule.Count; i++)
- {
- var dayLabel = new Label
- {
- Text = DateHelper.GetDate(scheduleData.schedule[i].Day.Date),
- Font = Font.SystemFontOfSize(15, FontAttributes.Bold),
- HorizontalOptions = LayoutOptions.Center,
- WidthRequest = AppConfig.DayLabelWidth,
- HeightRequest = AppConfig.DayLabelHeight,
- TextColor = Color.Black,
- BackgroundColor = Color.FromHex(AppConfig.DayLabelBackgroundColorHex)
- };
- layout.Children.Add(dayLabel);
- for (int j = 0; j < scheduleData.schedule[i].Events.Count; j++)
- {
- var EventRow = new StackLayout()
- {
- Spacing = 0,
- Orientation = StackOrientation.Horizontal
- };
- var EventStatusImage = new Image()
- {
- HorizontalOptions = LayoutOptions.End,
- HeightRequest = AppConfig.EventStatusImageHeight,
- WidthRequest = AppConfig.EventStatusImageWidth,
- Source = EventStatusHelper.GetImageSource(scheduleData.schedule[i].Events[j])
- };
- var button = new Button
- {
- Text = EventsMapper.GetName(scheduleData.schedule[i].Events[j].EventType) +
- "\n" +
- scheduleData.schedule[i].Events[j].EventStartTime + " - " +
- scheduleData.schedule[i].Events[j].EventEndTime,
- //use string bilder?
- HorizontalOptions = LayoutOptions.End,
- HeightRequest = AppConfig.EventButtonHeight,
- WidthRequest = AppConfig.EventButtonWidth,
- BackgroundColor = Color.FromHex(AppConfig.DomainColorHex),
- TextColor = Color.White,
- };
- var thisEvent = scheduleData.schedule[i].Events[j];
- button.Clicked += async delegate
- {
- await Navigation.PushAsync(new EventDetailsPage(thisEvent, User));
- };
- EventRow.Children.Add(EventStatusImage);
- EventRow.Children.Add(button);
- layout.Children.Add(EventRow);
- eventsCount++;
- }
- }
- }
- catch(Exception e)
- {
- // to do
- }
- }