示例#1
0
 public BillService(IBillRepository billRepository, IUserRepository userRepository,
                    IDeliveryRepository deliveryRepository, IWayRepository wayRepository)
 {
     _billRepository     = billRepository;
     _userRepository     = userRepository;
     _deliveryRepository = deliveryRepository;
     _wayRepository      = wayRepository;
 }
 public StatsService(IActivityRepository activityRepository,
                     IWayRepository wayRepository,
                     ISlopeLengthCalculator slopeLengthCalculator)
 {
     _activityRepository    = activityRepository;
     _wayRepository         = wayRepository;
     _slopeLengthCalculator = slopeLengthCalculator;
 }
示例#3
0
 public SlopeLengthCalculator(IWayRepository wayRepository)
 {
     _wayRepository = wayRepository;
 }
 public SlopeFinder(IWayRepository wayRepository)
 {
     _wayRepository = wayRepository;
 }
 public LiftFinder(IWayRepository wayRepository)
 {
     _wayRepository = wayRepository;
 }
 public DeliveryService(IWayRepository wayRepository, IDeliveryRepository deliveryRepository)
 {
     _wayRepository      = wayRepository;
     _deliveryRepository = deliveryRepository;
 }
        public MainViewModel(IWayRepository wayRepository, ILiftFinder liftFinder,
                             IActivityRepository activityRepository, ISlopeNodeChecker slopeNodeChecker,
                             IStatsService statsService)
        {
            _wayRepository    = wayRepository;
            _slopeNodeChecker = slopeNodeChecker;
            _statsService     = statsService;
            _liftFinder       = liftFinder;

            PropertyChanged += (sender, args) =>
            {
                switch (args.PropertyName)
                {
                case nameof(SelectedLift):
                    ShowSelectedLift();
                    break;

                case nameof(SelectedLap):
                    ShowSelectedLap();
                    break;
                }
            };

            // Changed displayOptions -> Update views accordingly
            DisplayOptions.PropertyChanged += (sender, args) =>
            {
                if (args.PropertyName != null && args.PropertyName.StartsWith("Show"))
                {
                    TakenLifts = new ObservableCollection <Way>();

                    MapItems.Reset();

                    Laps       = new ObservableCollection <Lap>();
                    Statistics = new Statistics();


                    var allActivities = new List <Lap>();
                    if (DisplayOptions.ShowTuesday)
                    {
                        allActivities.AddRange(activityRepository.GetSingleDay(Day.Tuesday));
                    }

                    if (DisplayOptions.ShowWednesday)
                    {
                        allActivities.AddRange(activityRepository.GetSingleDay(Day.Wednesday));
                    }

                    if (DisplayOptions.ShowThursday)
                    {
                        allActivities.AddRange(activityRepository.GetSingleDay(Day.Thursday));
                    }

                    if (DisplayOptions.ShowFriday)
                    {
                        allActivities.AddRange(activityRepository.GetSingleDay(Day.Friday));
                    }

                    if (DisplayOptions.ShowSaturday)
                    {
                        allActivities.AddRange(activityRepository.GetSingleDay(Day.Saturday));
                    }

                    var allTrackingPoints = allActivities.SelectMany(a => a.TrackingPoints);

                    CalculateStats(allTrackingPoints);

                    foreach (var lap in allActivities)
                    {
                        Laps.Add(lap);
                        var firstPoint = lap.TrackingPoints.FirstOrDefault();
                        ShowLapStartFlags(firstPoint, lap.Number);

                        CheckTakenLifts(firstPoint);
                        ShowTrackingPoints(lap);
                        ShowSpeedLine(lap);
                        ShowHeartRateLine(lap);
                    }
                }

                LiftStatistics = _statsService.CalculateLiftStatistics(TakenLifts);
                ShowLiftNamePins();
            };

            DrawMadeSlopes();
            DrawSlopes();
            DrawLifts();
        }