public async override void Start() { if (await synchronisationService.AuthorizeTokenSynchronisationAsync()) { await Task.Run(RefreshToolRoadsAsync); } else { Close(this); if (IsBound) { _track.StopServices(); } ShowViewModel <LoginViewModel>(); return; } base.Start(); _tokens.Add(_messenger.SubscribeOnMainThread <GeoWatcherStatusMessage>((s) => IsBound = s.Data, MvxReference.Strong)); _tokens.Add(_messenger.SubscribeOnThreadPoolThread <LocationMessage>(x => Location = x.Data, MvxReference.Strong)); _tokens.Add(_messenger.SubscribeOnThreadPoolThread <StatusMessage>(x => StatusString = x.Data.ToString(), MvxReference.Strong)); _tokens.Add(_messenger.SubscribeOnMainThread <TollRoadChangedMessage>((s) => TollRoadString = s.Data?.Name, MvxReference.Strong)); await synchronisationService.DataSynchronisationAsync(); StatusString = _track.TollStatus.ToString(); TollRoadString = WaypointChecker.TollRoad?.Name; if (_geoWatcher.Location != null) { Location = _geoWatcher.Location; WaypointChecker.DetectWeAreInsideSomeTollPoint(Location); } }
public async override void Start() { if (await synchronisationService.AuthorizeTokenSynchronisationAsync()) { await Task.Run(RefreshToolRoadsAsync); } else { Close(this); ShowViewModel <LoginViewModel>(); return; } base.Start(); _tokens.Add(_messenger.SubscribeOnThreadPoolThread <LocationMessage>(x => Location = x.Data, MvxReference.Strong)); _tokens.Add(_messenger.SubscribeOnThreadPoolThread <StatusMessage>(x => StatusString = x.Data.ToString(), MvxReference.Strong)); _tokens.Add(_messenger.SubscribeOnThreadPoolThread <MotionMessage>(x => MotionType = x.Data, MvxReference.Strong)); _tokens.Add(_messenger.SubscribeOnMainThread <LogUpdated>((s) => LogText = Log._messageLog.ToString(), MvxReference.Strong)); _tokens.Add(_messenger.SubscribeOnMainThread <GeoWatcherStatusMessage>((s) => IsBound = s.Data, MvxReference.Strong)); _tokens.Add(_messenger.SubscribeOnMainThread <CurrentTollpointChangedMessage>((s) => CurrentWaypointString = string.Join("\n", s.Data?.Select(x => x.Name)), MvxReference.Strong)); _tokens.Add(_messenger.SubscribeOnMainThread <TollRoadChangedMessage>((s) => TollRoadString = s.Data?.Name, MvxReference.Strong)); if (_geoWatcher.Location != null) { Location = _geoWatcher.Location; } LogText = Log._messageLog.ToString(); StatusString = _track.TollStatus.ToString(); TollRoadString = waypointChecker.TollRoad?.Name; if (waypointChecker.TollPointsInRadius != null) { CurrentWaypointString = string.Join("\n", waypointChecker.TollPointsInRadius?.Select(x => x.Name)); } }