public HomeViewModel(IMvxMessenger messenger, ITrackFacade track, IGeoLocationWatcher geoWatcher, IStoredSettingsService storedSettingsService, ISynchronisationService synchronisationService) { _messenger = messenger; _track = track; _geoWatcher = geoWatcher; _storedSettingsService = storedSettingsService; IsBound = _geoWatcher.IsBound; this.synchronisationService = synchronisationService; logoutCommand = new MvxCommand(() => { _track.StopServices(); _storedSettingsService.IsAuthorized = false; Close(this); ShowViewModel <LoginViewModel>(); }); _profileCommand = new MvxCommand(() => { ShowViewModel <ProfileViewModel>(); }); _payCommand = new MvxCommand(() => { }); _payHistoryCommand = new MvxCommand(() => { ShowViewModel <PayHistoryViewModel>(); }); _trackingCommand = new MvxCommand(async() => { Log.LogMessage("Tracking button is pressed!"); IsBound = !IsBound; var result = IsBound ? await _track.StartServices() : _track.StopServices(); IsBound = _geoWatcher.IsBound; }); _tokens = new List <MvxSubscriptionToken>(); }
public HomeTestViewModel(IMvxMessenger messenger, ITrackFacade track, IGeoLocationWatcher geoWatcher, IStoredSettingsService storedSettingsService) { _track = track; _messenger = messenger; _geoWatcher = geoWatcher; _storedSettingsService = storedSettingsService; _tokens = new List <MvxSubscriptionToken>(); }
public HomeDebugViewModel(IMvxMessenger messenger, ITrackFacade track, IGeoLocationWatcher geoWatcher, IStoredSettingsService storedSettingsService, ISynchronisationService synchronisationService) { _track = track; _messenger = messenger; _geoWatcher = geoWatcher; IsBound = _geoWatcher.IsBound; this.synchronisationService = synchronisationService; _storedSettingsService = storedSettingsService; _tokens = new List <MvxSubscriptionToken>(); }
public HomeViewModel(IMvxMessenger messenger, ITrackFacade track, IGeoLocationWatcher geoWatcher, IStoredSettingsService storedSettingsService, ISynchronisationService synchronisationService, IWaypointChecker waypointChecker, IGeoDataService geoDataService) { _messenger = messenger; _track = track; _geoWatcher = geoWatcher; _storedSettingsService = storedSettingsService; this.WaypointChecker = waypointChecker; this.synchronisationService = synchronisationService; this.geoDataService = geoDataService; IsBound = _geoWatcher.IsBound; logoutCommand = new MvxCommand(() => { _track.StopServices(); _storedSettingsService.IsAuthorized = false; Close(this); ShowViewModel <LoginViewModel>(); }); _profileCommand = new MvxCommand(() => { ShowViewModel <ProfileViewModel>(); }); _payCommand = new MvxCommand(() => { ShowViewModel <PayViewModel>(); }); _payHistoryCommand = new MvxCommand(() => { ShowViewModel <PayHistoryViewModel>(); }); _trackingCommand = new MvxCommand(async() => { Log.LogMessage("Tracking button is pressed!"); IsBound = !IsBound; var result = IsBound ? await _track.StartServicesAsync() : _track.StopServices(); IsBound = _geoWatcher.IsBound; }); _tokens = new List <MvxSubscriptionToken>(); NextGeoLocationCommand = new MvxCommand(() => NextLocation()); PlayPauseIterationCommand = new MvxCommand(() => PlayPauseLocationIteration()); WaypointActions = new List <WaypointAction>() { WaypointAction.Entrance, WaypointAction.Bridge, WaypointAction.Exit }; SelectedWaypointAction = WaypointAction.Entrance; }
public TrackFacade(ITextToSpeechService textToSpeech, IMvxMessenger messenger, IGeoLocationWatcher geoWatcher, IMotionActivity activity, IStoredSettingsService storedSettingsService, IWaypointChecker waypointChecker) { Log.LogMessage("Facade ctor start"); _textToSpeech = textToSpeech; _messenger = messenger; _geoWatcher = geoWatcher; _activity = activity; _storedSettingsService = storedSettingsService; this.waypointChecker = waypointChecker; _tokens = new List <MvxSubscriptionToken>(); // was changed _semaphor = new SemaphoreSlim(1); _motionToken = _messenger.SubscribeOnThreadPoolThread <MotionMessage>(async x => { Log.LogMessage($"[FACADE] receive new motion type {x.Data}"); switch (x.Data) { case MotionType.Automotive: case MotionType.Running: case MotionType.Walking: if ((_storedSettingsService.SleepGPSDateTime == DateTime.MinValue || _storedSettingsService.SleepGPSDateTime < DateTime.Now) && !IsBound) { Log.LogMessage($"[FACADE] Start geolocating because we are not still"); await StartServicesAsync(); } break; case MotionType.Still: if (IsBound) { Log.LogMessage($"[FACADE] Stop geolocating because we are still"); StopServices(); } break; } }); _tokens.Add(_motionToken); Log.LogMessage("Facade ctor end"); }
public TrackFacade() { Log.LogMessage("Facade ctor start"); _textToSpeech = Mvx.Resolve <ITextToSpeechService>(); _messenger = Mvx.Resolve <IMvxMessenger>(); _geoWatcher = Mvx.Resolve <IGeoLocationWatcher>(); _activity = Mvx.Resolve <IMotionActivity>(); _storedSettingsService = Mvx.Resolve <IStoredSettingsService>(); _semaphor = new SemaphoreSlim(1); //_motionToken = _messenger.SubscribeOnThreadPoolThread<MotionMessage>(async x => // { // Log.LogMessage($"[FACADE] receive new motion type {x.Data}"); // switch (x.Data) // { // case MotionType.Automotive: // case MotionType.Running: // case MotionType.Walking: // if ((_storedSettingsService.SleepGPSDateTime == DateTime.MinValue || _storedSettingsService.SleepGPSDateTime < DateTime.Now) // && !IsBound) // { // Log.LogMessage($"[FACADE] Start geolocating because we are not still"); // await StartServices(); // } // break; // case MotionType.Still: // if (IsBound) // { // Log.LogMessage($"[FACADE] Stop geolocating because we are still"); // StopServices(); // } // break; // } // }); //_tokens.Add(_motionToken); Log.LogMessage("Facade ctor end"); }
public BatteryDrainService() { _geoWatcher = Mvx.Resolve <IGeoLocationWatcher>(); _storedSettingsService = Mvx.Resolve <IStoredSettingsService>(); _motionActivity = Mvx.Resolve <IMotionActivity>(); }