Example #1
0
        public DialogViewModel(ILocationService locationService, ITravelPanelService travelPanelService,
                               IStartButtonService startButtonService, ITrailService trailService)
        {
            _visible.Raise(true);
            _locationService    = locationService;
            _travelPanelService = travelPanelService;
            _startButtonService = startButtonService;
            _trailService       = trailService;

            var currentLocation = _locationService.CurrentLocation;


            var nearestPoint = _locationService.GetNearestPoint(currentLocation, _trailService.Points);

            if (_locationService.CheckPointIsNear(currentLocation, nearestPoint)) // user and point location
            {
                CanStart          = true;
                TrailStartCommand = new MvxCommand(StartTrail);
                TrailTitle        = "MOŻNA"; // here name of point
                TrailInfo         = "Możesz rozpocząć swoją wędrówkę!";
            }
            else
            {
                var distance = _locationService.GetDistanceBetweenTwoPointsOnMapInMeters(currentLocation, nearestPoint);
                CanStart   = false;
                TrailTitle = "NIE MOŻNA";                                                                                       //some function should be here, but idk how i want to do here
                TrailInfo  = "Najbliższy punkt to " + nearestPoint.Name + " oddalony o " + _locationService.Distance(distance); // name of nearest point
            }
            NearestPointCommand = new MvxCommand(ShowNearestPoint);
        }
Example #2
0
        public AfterStartDialogViewModel(ILocationService locationService, ITravelPanelService travelPanelService,
                                         IStartButtonService startButtonService)
        {
            _visible.Raise(true);
            _locationService    = locationService;
            _travelPanelService = travelPanelService;
            _startButtonService = startButtonService;

            _travelPanelService.SetTravelTime();
            TimeInfo       = "Twoj czas: " + _travelPanelService.TravelTime;
            StopTravel     = new MvxCommand(ExecuteStopTravel);
            DontStopTravel = new MvxCommand(ExecuteDontStopTravel);
        }