/// <summary> /// Initializes a new instance of the <see cref="TrackingPageViewModel"/> class. /// </summary> /// <param name="gpxHandler">The Gpx handler implementation it depends on.</param> /// <param name="locationTracker">The location tracker implementation it depends on.</param> /// <param name="settingOperator">The setting operator implementation it depends on.</param> public TrackingPageViewModel(IGpxHandler gpxHandler, ILocationTracker locationTracker, ISettingOperator settingOperator) { this.gpxHandler = gpxHandler ?? throw new ArgumentNullException(nameof(gpxHandler)); this.locationTracker = locationTracker ?? throw new ArgumentNullException(nameof(locationTracker)); this.settingOperator = settingOperator ?? throw new ArgumentNullException(nameof(settingOperator)); this.status = TrackingStatus.Stopped; this.StartPauseClickedCommand = new DelegateCommand <ItemClickEventArgs>(this.OnStartPauseClicked, this.CanStartPauseClick); this.StopClickedCommand = new DelegateCommand <ItemClickEventArgs>(this.OnStopClicked, this.CanStopClick); this.SelectedActivity = ActivityType.Unknown; this.CoordinateInformation = "Your location information"; this.settingOperator.ResetSettings(); this.refreshTimer = new DispatcherTimer() { Interval = new TimeSpan(0, 0, 30) }; this.refreshTimer.Tick += async(object sender, object e) => { await this.DisplayMostRecentLocationData(string.Empty); }; Debug.WriteLine($"{DateTime.Now} - Attached LocationTracker_OnTrackingProgressChangedEvent event handler."); this.locationTracker.OnTrackingProgressChangedEvent += this.LocationTracker_OnTrackingProgressChangedEvent; this.trackingMechanism = TrackingMechanismDisplay.GetSavedTrackingMechanism(this.settingOperator); }
public RouteRecorder(ILocationTracker locationTracker) { _LocationTracker = locationTracker; _locationChangedSubscription = _LocationTracker.WeakSubscribe <ILocationTracker, LocationMovedEventArgs>(nameof(LocationTracker.Moved), UserMoved); }
private ILocationTracker InitializeLocationTracker() { ILocationTracker tracker = Mvx.IocConstruct <LocationTracker>(); tracker.Start(3, 2, false); return(tracker); }
public FromLocationPageViewModel(ILocationTracker locationTracker, INavigationService navigationService, ITaxiService taxiService) { _locationTracker = locationTracker; _navigationService = navigationService; _taxiService = taxiService; init(); }
public WhereAmIPage() { InitializeComponent(); ILocationTracker locationTracker = DependencyService.Get <ILocationTracker>(); locationTracker.LocationChanged += OnLocationTrackerLocationChanged; locationTracker.StartTracking(); }
public GoToLocationPage() { InitializeComponent(); if (Device.OS != TargetPlatform.Android) { locationTracker = DependencyService.Get <ILocationTracker>(); locationTracker.LocationChanged += OnLocationTracker; } }
public LocalMuseumsPage() { InitializeComponent(); // Center the map on the 48-states geographic center. map.MoveToRegion(MapSpan.FromCenterAndRadius( new Position(39.828175, -98.579500), RADIUS)); // Track user's location. locationTracker = DependencyService.Get <ILocationTracker>(); locationTracker.LocationChanged += OnLocationTracker; // Track map center. Device.StartTimer(TimeSpan.FromSeconds(1), OnTimerCallback); }
/// <summary> /// Initializes a new instance of the <see cref="CurrentLocationPageViewModel"/> class. /// </summary> /// <param name="locationTracker">The location tracker implementation it depends on.</param> public CurrentLocationPageViewModel(ILocationTracker locationTracker) { this.locationTracker = locationTracker ?? throw new ArgumentNullException(nameof(locationTracker)); this.PositionSourceDisplayValue = UnknownValue; this.LatitudeDisplayValue = UnknownValue; this.LongitudeDisplayValue = UnknownValue; this.AccuracyDisplayValue = UnknownValue; this.AltitudeDisplayValue = UnknownValue; this.AltitudeAccuracyDisplayValue = UnknownValue; this.HeadingDisplayValue = UnknownValue; this.SpeedDisplayValue = UnknownValue; this.StartButtonClickedCommand = new DelegateCommand <ItemClickEventArgs>(this.OnStartClicked, this.CanStartClick); }
/// -------------------------------------------------------------------------------- /// <summary> /// Initializes a new instance of the <see cref="RestoreSelInfo"/> struct. /// </summary> /// <param name="locTracker">The location tracker.</param> /// <param name="selHelper">The selection helper.</param> /// <param name="iBookAnchor">The index of the book (in the bookfilter) at the /// anchor.</param> /// <param name="iSectionAnchor">The index of the section at the anchor (relative to /// the book).</param> /// <param name="iBookEnd">The index of the book (in the bookfilter) at the /// end.</param> /// <param name="iSectionEnd">The index of the section at the end (relative to the /// book).</param> /// <param name="fIsActiveView"><c>true</c> if the selection info is for the /// currently active view.</param> /// -------------------------------------------------------------------------------- public RestoreSelInfo(ILocationTracker locTracker, SelectionHelper selHelper, int iBookAnchor, int iSectionAnchor, int iBookEnd, int iSectionEnd, bool fIsActiveView) { LocationTracker = locTracker; SelHelper = selHelper; this.iBookAnchor = iBookAnchor; this.iSectionAnchor = iSectionAnchor; this.iBookEnd = iBookEnd; this.iSectionEnd = iSectionEnd; IsActiveView = fIsActiveView; }