Exemplo n.º 1
0
        public CommunityBikesViewModel(IDialogService dialogService,
                                       IBikeService bikeService,
                                       IMembershipService membershipService,
                                       INavigationService navigationService,
                                       string id)
        {
            _dialogService     = dialogService;
            _bikeService       = bikeService;
            _navigationService = navigationService;

            _communityId = id;

            AddBikeCommand  = CreateCommand(AddBike);
            EditBikeCommand = CreateCommand <Bike>(EditBike, CanEditBike);

            PropertyChanged += (_, args) =>
            {
                if (args.PropertyName == nameof(CurrentUserMembership))
                {
                    OnPropertyChanged(nameof(CanAddBike));
                }
            };

            Bikes = _bikeService.ObserveBikesFromCommunity(_communityId);
            Bikes.CollectionChanged += (_, _) => OnPropertyChanged(nameof(SortedBikes));

            membershipService.Observe(_communityId).Subscribe(
                membership => CurrentUserMembership = membership,
                exception => CurrentUserMembership  = null);
        }
Exemplo n.º 2
0
 public BikeController(IBikeService bikeService, IUserManagerService userManagerService, ICommitProvider commitProvider, IOrderRepository orderRepository, IOrderService orderService)
 {
     _bikeService        = bikeService;
     _userManagerService = userManagerService;
     _commitProvider     = commitProvider;
     _orderRepository    = orderRepository;
     _orderService       = orderService;
 }
 public TrainService(
     ILogger <TrainService> log,
     IBikeService bikeService) // ERROR!
 {
     _log         = log;
     _bikeService = bikeService;
     _log.LogInformation("Instanciated [Singleton] TrainService {InstanceId}", this);
 }
Exemplo n.º 4
0
 public void SetUp()
 {
     mockRepo               = new Mock <IBikeRepository>();
     mockMapper             = new Mock <IMapper>();
     mockHistoryService     = new Mock <IBikeHistoryService>();
     mockHistoryNoteService = new Mock <IHistoryNoteService>();
     mockInspectionService  = new Mock <IObjectInspectionService>();
     bikeService            = new BikeService(mockMapper.Object, mockRepo.Object, mockHistoryService.Object, mockHistoryNoteService.Object, mockInspectionService.Object);
 }
        public RealTimeModel(ISchedulerProvider schProvider, IBikeService bikeService)
        {
            _schProvider = schProvider;
            _bikeService = bikeService;
            _bikeDataSource = new SourceCache<StationDto, string>(bike => bike.Name);
            _all = _bikeDataSource.AsObservableCache();

            var data = GenerateRealTimeData();
            _cleanup = new CompositeDisposable(_all, _bikeDataSource, data);
        }
        public EditBikeViewModel(
            IDialogService dialogService,
            ILockService lockService,
            IBikeService bikeService,
            IMembershipService membershipService,
            ICommunityService communityService,
            ILocationPicker locationPicker,
            IQRCodeScanner qrCodeScanner,
            INavigationService navigationService,
            string communityId,
            string bikeId)
        {
            _dialogService     = dialogService;
            _lockService       = lockService;
            _bikeService       = bikeService;
            _membershipService = membershipService;
            _communityService  = communityService;
            _locationPicker    = locationPicker;
            _qrCodeScanner     = qrCodeScanner;
            _navigationService = navigationService;

            _communityId = communityId;
            _bikeId      = bikeId;

            SetLocationCommand       = CreateCommand <Bike>(SetLocation, CanSetLocation);
            RenameBikeCommand        = CreateCommand <Bike>(RenameBike, CanRenameBike);
            DeleteBikeCommand        = CreateCommand <Bike>(DeleteBike, CanDeleteBike);
            ShowCurrentLenderCommand = CreateCommand <Bike>(ShowCurrentLender, CanShowCurrentLender);
            AddLockCommand           = CreateCommand <Bike>(AddLock, CanAddLock);
            AddLockWithQRCodeCommand = CreateCommand <Bike>(AddLockWithQRCode, CanAddLock);
            OpenLockCommand          = CreateCommand <Bike>(OpenLock, CanOpenLock);
            CloseLockCommand         = CreateCommand <Bike>(CloseLock, CanCloseLock);
            RemoveLockCommand        = CreateCommand <Bike>(RemoveLock, CanRemoveLock);

            PropertyChanged += (_, args) =>
            {
                switch (args.PropertyName)
                {
                case nameof(Bike):
                {
                    OnPropertyChanged(nameof(Name));
                    OnPropertyChanged(nameof(LendState));
                    OnPropertyChanged(nameof(LockState));
                    break;
                }

                case nameof(CurrentUserMembership):
                {
                    // Needed to update permissions for the commands
                    OnPropertyChanged(nameof(Bike));
                    break;
                }
                }
            };
        }
Exemplo n.º 7
0
        public OverviewViewModel(
            IBikeService bikeService,
            ILocationService locationService,
            IStationService stationService,
            INavigationService navigationService,
            IDialogService dialogService)
        {
            _locationService   = locationService;
            _navigationService = navigationService;
            _dialogService     = dialogService;
            _locationService   = locationService;

            ShowBikeOnMapCommand       = CreateCommand <Bike>(ShowBikeOnMap, CanShowBikeOnMap);
            RefreshUserLocationCommand = CreateCommand(RefreshUserLocation);
            ToggleMapCommand           = CreateCommand(ToggleMap);

            ShowMap = Preferences.Get("ShowMap", false);

            PropertyChanged += (_, args) =>
            {
                switch (args.PropertyName)
                {
                case nameof(ShowMap):
                    OnPropertyChanged(nameof(ToggleMapText));
                    Preferences.Set("ShowMap", ShowMap);
                    break;

                case nameof(UserLocation):
                    OnPropertyChanged(nameof(GroupedItems));
                    break;

                case nameof(AllBikes) or nameof(AllStations):
                    OnPropertyChanged(nameof(MapItems));

                    OnPropertyChanged(nameof(GroupedItems));
                    break;
                }
            };

            var bikes = bikeService.GetAvailableBikes();

            bikes.CollectionChanged += (_, _) =>
            {
                AllBikes.ReplaceRange(bikes);
                OnPropertyChanged(nameof(AllBikes));
            };

            var stations = stationService.GetAvailableStations();

            stations.CollectionChanged += (_, _) =>
            {
                AllStations.ReplaceRange(stations);
                OnPropertyChanged(nameof(AllStations));
            };
        }
Exemplo n.º 8
0
 public RentalCompany(string name, IBikeService service, IIncomeCalculator calculator, IRentedBikeService rentedService)
 {
     if (string.IsNullOrEmpty(name))
     {
         throw new RentalCompanyNotNullException();
     }
     Name               = name;
     _service           = service;
     _calculator        = calculator;
     _rentedBikeService = rentedService;
 }
Exemplo n.º 9
0
 public HomeController(
     ILogger <HomeController> log,
     IBikeService bikeService,
     ICarService carService,
     ITrainService trainService)
 {
     _log          = log;
     _bikeService  = bikeService;
     _carService   = carService;
     _trainService = trainService;
 }
Exemplo n.º 10
0
        public BikeViewModel(
            IBikeService bikeService,
            ILockService lockService,
            IDialogService dialogService,
            ICommunityService communityService)
        {
            _bikeService      = bikeService;
            _lockService      = lockService;
            _dialogService    = dialogService;
            _communityService = communityService;

            LendBikeCommand          = CreateCommand <Bike>(LendBike, bikeService.CanLendBike);
            ReturnBikeCommand        = CreateCommand <Bike>(ReturnBike, bikeService.CanReturnBike);
            ReserveBikeCommand       = CreateCommand <Bike>(ReserveBike, bikeService.CanReserveBike);
            DeleteReservationCommand = CreateCommand <Bike>(DeleteReservation, bikeService.CanDeleteReservation);
            TakeBreakCommand         = CreateCommand <Bike>(TakeBreak, CanTakeBreak);
            EndBreakCommand          = CreateCommand <Bike>(EndBreak, CanEndBreak);
            ReportProblemCommand     = CreateCommand <Bike>(ReportProblem, CanReportProblem);
        }
Exemplo n.º 11
0
        public RentService(
            IDepositCalculator depositCalculator,
            IRepository <Rent> rentRepository,
            IDepositService depositService,
            IBikeService bikeService)
        {
            if (depositCalculator == null)
            {
                throw new ArgumentNullException(nameof(depositCalculator));
            }

            if (rentRepository == null)
            {
                throw new ArgumentNullException(nameof(rentRepository));
            }

            _depositCalculator = depositCalculator;
            _rentRepository    = rentRepository;
            _depositService    = depositService;
            _bikeService       = bikeService;
        }
        public StationDetailViewModel(
            IStationService stationService,
            IBikeService bikeService,
            IDialogService dialogService,
            string communityId,
            string stationId)
        {
            _stationService = stationService;
            _bikeService    = bikeService;
            _dialogService  = dialogService;
            _communityId    = communityId;
            _stationId      = stationId;

            PropertyChanged += (_, args) =>
            {
                if (args.PropertyName == nameof(Station))
                {
                    OnPropertyChanged(nameof(Name));
                    OnPropertyChanged(nameof(Description));
                }
            };
        }
Exemplo n.º 13
0
 public BikeController(IBikeService bikeService,
                       ILogger <BikeController> logger)
 {
     BikeService = bikeService;
     Logger      = logger;
 }
Exemplo n.º 14
0
 public MoveBikeCommand(IBikeService bikeService)
 {
     _bikeService = bikeService;
 }
Exemplo n.º 15
0
 public FileController(IBikeService bikeService, IMapper mapper)
 {
     this.bikeService = bikeService;
     this.mapper      = mapper;
 }
Exemplo n.º 16
0
 public BikeController(IBikeService bikeService)
 {
     _bikeService = bikeService ?? throw new ArgumentNullException(nameof(IBikeService));
 }
Exemplo n.º 17
0
 public BikesController(ApplicationDbContext data, IBikeService bikeService, IMapper mapper)
 {
     this.data        = data;
     this.bikeService = bikeService;
     this.mapper      = mapper;
 }
Exemplo n.º 18
0
 public UpdateBikeHandler(IBikeService bikeService, IEventPublisher client)
 {
     _bikeService = bikeService;
     _client      = client;
 }
Exemplo n.º 19
0
 public AddNewBikeCommand(IBikeService bikeService)
 {
     _bikeService = bikeService;
 }
Exemplo n.º 20
0
 public Bike(IBikeService bikeService)
 {
     _bikeService = bikeService;
 }
Exemplo n.º 21
0
 public UpdateBikeStatusByIdAsyncCommandHandler(IBikeService bikeService)
 {
     _bikeService = bikeService;
 }
Exemplo n.º 22
0
 public AddBikeCommand(IBikeNameVerifier bikeNameVerifier, IBikeService bikeService)
 {
     _bikeNameVerifier = bikeNameVerifier;
     _bikeService      = bikeService;
 }
Exemplo n.º 23
0
 public GetAllBikesHandler(IBikeService bikeService)
 {
     _bikeService = bikeService;
 }
Exemplo n.º 24
0
 public AddBikeToRentPointCommand(IBikeService bikeService)
 {
     _bikeService = bikeService;
 }
Exemplo n.º 25
0
 public HomeController(IBikeService bikeService, ITripService tripService, IUserManagerService userManagerService)
 {
     _bikeService        = bikeService;
     _tripService        = tripService;
     _userManagerService = userManagerService;
 }
Exemplo n.º 26
0
 public DeleteBikeHandler(IBikeService bikeService, IEventPublisher client)
 {
     _client      = client;
     _bikeService = bikeService;
 }
 public BikesController(IBikeService bikeService)
 {
     this.bikeService = bikeService;
 }
Exemplo n.º 28
0
 public BikeController(IBikeService bikeService)
 {
     _bikeService = bikeService;
 }
Exemplo n.º 29
0
 public GetBikeByIdHandler(IBikeService bikeService)
 {
     _bikeService = bikeService;
 }
 public DeleteBikeByIdAsyncCommandHandler(IBikeService bikeService)
 {
     _bikeService = bikeService;
 }
Exemplo n.º 31
0
 public GetBikeByIdAsyncQueryHandler(IBikeService bikeRepository)
 {
     _bikeRepository = bikeRepository;
 }