Example #1
0
        public AddressMapViewModel(IMvxNavigationService navigationService,
                                   IConnection connection, IMvxMessenger messenger,
                                   IPermissionDependency permissionDependency, IGoogleMapsApiService googleMapsApiService,
                                   IGoogleMapTableAccess googleMapTableAccess, IQuickMessageDependency quickMessageDependency)
        {
            _navigationService      = navigationService;
            _connection             = connection;
            _messenger              = messenger;
            _permissionDependency   = permissionDependency;
            _googleMapsApiService   = googleMapsApiService;
            _googleMapTableAccess   = googleMapTableAccess;
            _quickMessageDependency = quickMessageDependency;
            Title = "Address Book";
            Init();

            _token = _messenger.Subscribe <AddressResult>((addr) =>
            {
                try
                {
                    if (addr != null)
                    {
                        if (!AddedAddresses.Any(x => x.PlaceId == addr.Address.PlaceId))
                        {
                            _googleMapTableAccess.Insert(addr.Address);
                            AddedAddresses.Add(addr.Address);
                            ExecuteSelect(addr.Address);
                        }
                    }
                }
                catch (Exception ex)
                {
                    _quickMessageDependency.ShowToastMessage(ex.Message);
                }
            });
        }
Example #2
0
 public SearchAddressViewModel(IMvxNavigationService navigationService
                               , IGoogleMapsApiService googleMapsApiService
                               , IMvxMessenger messenger, IQuickMessageDependency quickMessageDependency)
 {
     _navigationService      = navigationService;
     _googleMapsApiService   = googleMapsApiService;
     _messenger              = messenger;
     _quickMessageDependency = quickMessageDependency;
     Init();
 }
Example #3
0
        /// <summary>
        /// Constructor for this class.
        /// </summary>

        /// <param name="mapper">Used to map between domain classes and request/response/dto classes.</param>
        /// <param name="googleMapsApiService">Used to send requests to the Google Maps Api</param>
        /// <param name="priceStrategyFactory">Used to get the correct strategy for price calculations</param>
        /// <param name="unitOfWork">Used to access the database repositories</param>
        public RideService(
            IMapper mapper,
            IGoogleMapsApiService googleMapsApiService,
            IPriceStrategyFactory priceStrategyFactory,
            IUnitOfWork unitOfWork,
            IMatchService matchService)
        {
            _mapper = mapper;
            _googleMapsApiService = googleMapsApiService;
            _priceStrategyFactory = priceStrategyFactory;
            _unitOfWork           = unitOfWork;
            _matchService         = matchService;
        }
Example #4
0
        public MainPage()
        {
            this.InitializeComponent();
            BtnUser.Click += BtnUser_Click;
            GlobalHelpers globalHelpers = new GlobalHelpers();

            _googleMapsApi = new GoogleMapsServices();
            _placesService = new PlacesService();
            //GoogleMapsServices.Initialize("AIzaSyAPbw5REd81rKh2BE3XbLoazyzKU859qHA");
            Suggestions             = new ObservableCollection <string>(_placesService.GetMatrackPlaces().Select(p => p.Name));
            _requestMatatuResponses = new List <RequestMatatuResponse>();
            listResponse.SelectionChanged
        }
Example #5
0
        public MainWindowViewModel(IGoogleMapsApiService googleMapsApiService)
        {
            _googleMapsApiService = googleMapsApiService;

            _latitude  = DefaultLatitude;
            _longitude = DefaultLongitude;
            _zoom      = DefaultZoom;

            _viewportScrollCommand = new RelayCommand(ViewportScrollExecute);
            _zoomInCommand         = new RelayCommand(ZoomInExecute, ZoomInCanExecute);
            _zoomOutCommand        = new RelayCommand(ZoomOutExecute, ZoomOutCanExecute);

            RefreshViewport();
        }
 public void Setup()
 {
     _mapper = Substitute.For <IMapper>();
     _googleMapsApiService    = Substitute.For <IGoogleMapsApiService>();
     _rideRepository          = Substitute.For <IRideRepository>();
     _soloRidePriceStrategy   = Substitute.For <IPriceStrategy>();
     _sharedRidePriceStrategy = Substitute.For <IPriceStrategy>();
     _priceStrategyFactory    = Substitute.For <IPriceStrategyFactory>();
     _unitOfWork    = Substitute.For <IUnitOfWork>();
     _matchService  = Substitute.For <IMatchService>();
     _rideService   = new RideService(_mapper, _googleMapsApiService, _priceStrategyFactory, _unitOfWork, _matchService);
     _anAddress     = new Address("city", 1000, "street", 1);
     _anAddress.Lat = 10;
     _anAddress.Lng = 10;
 }
Example #7
0
 public MapViewModel()
 {
     googleMapsApi = new GoogleMapsApiService();
     Map           = new Map
     {
         InitialCameraUpdate = CameraUpdateFactory.NewPositionZoom(new Position(-2.19d, -79.89d), 12d),
         MapType             = MapType.Street,
     };
     Map.UiSettings.ZoomControlsEnabled = false;
     RequestLocationServices();
     Map.MapLongClicked   += Map_MapLongClicked;
     Map.PinDragEnd       += Map_PinDragEnd;
     GetPlacesCommand      = new Command <string>(async(param) => await GetPlacesByName(param));
     GetPlaceDetailCommand = new Command <GooglePlaceAutoCompletePrediction>(async(param) => await SetPlaceSelectedOnMap(param));
     LoadRouteCommand      = new Command(() => DrawRoute());
 }