/// <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);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="SettingPageViewModel"/> class.
        /// </summary>
        /// <param name="sessionService">The session state service it depends on.</param>
        /// <param name="gpxHandler">The Gpx handler implementation it depends on.</param>
        /// <param name="settingOperator">The setting operator implementation it depends on.</param>
        public SettingPageViewModel(ISessionStateService sessionService, IGpxHandler gpxHandler, ISettingOperator settingOperator)
        {
            this.gpxHandler      = gpxHandler ?? throw new ArgumentNullException(nameof(gpxHandler));
            this.settingOperator = settingOperator ?? throw new ArgumentNullException(nameof(settingOperator));
            this.sessionService  = sessionService;

            this.ClearTempFileButtonClickedCommand = new DelegateCommand <ItemClickEventArgs>(this.OnClearTempFileButtonClicked, this.CanClearTempFileButtonClick);
            this.isTempFileDeleteButtonEnabled     = true;
        }
Esempio n. 3
0
        /// <summary>
        /// Gets the saved tracking mechanism, if not found use the <see cref="TrackingMechanism.LocationServiceProgressChangedEvent"/> as default value.
        /// </summary>
        /// <param name="settingOperator">A setting operator implementation.</param>
        /// <returns>The saved tracking mechanism.</returns>
        public static TrackingMechanism GetSavedTrackingMechanism(ISettingOperator settingOperator)
        {
            var trackingMechanismId = settingOperator.GetTrackingMechanismId();

            if (trackingMechanismId == null)
            {
                return(TrackingMechanism.LocationServiceProgressChangedEvent);
            }
            else
            {
                return((TrackingMechanism)trackingMechanismId.Value);
            }
        }
Esempio n. 4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="GpsTrackingTask"/> class.
 /// </summary>
 public GpsTrackingTask()
 {
     this.setting    = new SettingOperator();
     this.gpxHandler = new GpxHandler();
 }