示例#1
0
        protected override async void OnViewLoaded(object view)
        {
            base.OnViewLoaded(view);
            RouteModel rm = RouteDataAccess.GetRouteById(RouteId);

            ServiceTemplateUI.RouteName = rm.RouteName;
            RouteId = rm.Id;
            ServiceTemplateUI.ServiceTemplateList = new BindableCollection <ServiceTemplateModel>(ServiceTemplateDataAccess.GetServiceTemplatesPerRoute(RouteId));
            ServiceDirectionList = new BindableCollection <ServiceDirectionModel>(ServiceDirectionDataAccess.GetAllServiceDirectionsPerRoute(RouteId));
            ServiceClassList     = ServiceClassDataAccess.GetAllServiceClasses();
            TimeEventTypeList    = TimeEventTypeDataAccess.GetAllTimeEventTypes();
            NotifyOfPropertyChange(() => TimeEventTypeList);
            NotifyOfPropertyChange(() => ServiceClassList);
            NotifyOfPropertyChange(() => ServiceTemplateUI);
            NotifyOfPropertyChange(() => ServiceDirectionList);
        }
示例#2
0
        private void PrepareDataSet()
        {
            TimeGraphUI      = new ObservableCollection <TimeGraphUIModel>();
            ServiceClassList = ServiceClassDataAccess.GetAllServiceClasses();
            var serviceList = new ObservableCollection <ServiceModel>(ServicesDataAccess.GetServicesPerTimetable(TimetableId));

            foreach (var service in serviceList)
            {
                var item = new TimeGraphUIModel();
                var serviceTemplateId = service.ServiceTemplateId;
                var serviceTemplate   = ServiceTemplateDataAccess.GetServiceTemplateById(serviceTemplateId);
                item.TimeEventList       = new BindableCollection <ExtendedFullTimeEventModel>(FullTimeEventDataAccess.GetAllExtendedFullTimeEventsPerServiceTemplate(serviceTemplateId));
                item.ServiceName         = service.ServiceName;
                item.ServiceAbbreviation = service.ServiceAbbreviation;
                item.ServiceType         = serviceTemplate.ServiceType;
                item.StartTimeText       = service.StartTimeText;
                item.EndTimeText         = service.EndTimeText;
                int actualTime = service.StartTime;
                foreach (var fullTimeEvent in item.TimeEventList)
                {
                    actualTime += fullTimeEvent.ArrivalTime;
                    fullTimeEvent.ArrivalTimeText = TimeConverters.MinutesToString(actualTime);
                    DataPoint point = GetFirstDataPoint(fullTimeEvent, actualTime);
                    item.DataLine.Add(point);
                    if (fullTimeEvent.WaitTime > 0)
                    {
                        actualTime += fullTimeEvent.WaitTime;
                        DataPoint point2 = GetSecondDataPoint(actualTime, point.X);
                        item.DataLine.Add(point2);
                    }
                    fullTimeEvent.DepartureTimeText = TimeConverters.MinutesToString(actualTime);
                }
                TimeGraphUI.Add(item);
            }
            OnPropertyChanged("TimeGraphUI");
        }