示例#1
0
        // Functions
        public ExercisePage()
        {
            // Setup
            InitializeComponent();
            _taskFactory     = new TaskFactory(TaskScheduler.FromCurrentSynchronizationContext());
            _viewModel       = new RunningExerciseViewModel(_taskFactory);
            this.DataContext = _viewModel;

            // Add GPS service if is first use
            if (_locationService == null)
            {
                _locationService = new GPSService(GPS_ACCURACY.HIGH, 20);
            }

            // Add handlers
            _locationService.GPSLocationChanged += GPSLocationChanged;
            _locationService.GPSLocationChanged += _viewModel.GPSLocationChanged;

            // Turn on GPS
            _locationService.StartService();

            // Set timer for updating running time
            _runUpdater          = new DispatcherTimer();
            _runUpdater.Interval = TimeSpan.FromSeconds(1);
            _timerTick           = (Object sender, EventArgs args) => { _viewModel.UpdateRunningTime(); };
            _runUpdater.Tick    += _timerTick;
            _runUpdater.Start();
        }
示例#2
0
        // Functions
        public ExercisePage()
        {
            // Setup
            InitializeComponent();
            _taskFactory = new TaskFactory(TaskScheduler.FromCurrentSynchronizationContext());
            _viewModel = new RunningExerciseViewModel(_taskFactory);
            this.DataContext = _viewModel;

            // Add GPS service if is first use
            if (_locationService == null)
            {
                _locationService = new GPSService(GPS_ACCURACY.HIGH, 20);
            }

            // Add handlers
            _locationService.GPSLocationChanged += GPSLocationChanged;
            _locationService.GPSLocationChanged += _viewModel.GPSLocationChanged;

            // Turn on GPS
            _locationService.StartService();

            // Set timer for updating running time
            _runUpdater = new DispatcherTimer();
            _runUpdater.Interval = TimeSpan.FromSeconds(1);
            _timerTick = (Object sender, EventArgs args) => { _viewModel.UpdateRunningTime(); };
            _runUpdater.Tick += _timerTick;
            _runUpdater.Start();
        }
示例#3
0
        public CameraPageViewModel()
        {
            Title            = "Upload Photo";
            TakePhotoCommand = new Command(
                async() => await TakePhoto(),
                () => !IsBusy);

            PickPhotoCommand = new Command(
                async() => await PickPhoto(),
                () => !IsBusy);

            UploadPhotoCommand = new Command(
                async() => await UploadPhoto(),
                () => !IsBusy);

            photo = null;

            dialogService = ServiceManager.GetObject <IDialogService>();
            photoService  = ServiceManager.GetObject <IPhotoService>();
            mobileService = ServiceManager.GetObject <IAzureService>();
            gpsService    = ServiceManager.GetObject <IGPSService>();
        }
 internal static void Init(IGPSService gps)
 {
     _instance = gps;
 }
 public CubeGPSController(ILogger <CubeGPSController> logger, IGPSService GPSService)
 {
     _GPSService = GPSService;
     _logger     = logger;
 }
示例#6
0
 public C25KService(ILog log, IGPSService gpsService)
 {
     _log = log;
       _gpsService = gpsService;
 }