コード例 #1
0
ファイル: HomeViewModel.cs プロジェクト: showmap/smartwalk
        public HomeViewModel(
            ISmartWalkApiService apiService,
            IExceptionPolicyService exceptionPolicy,
            IAnalyticsService analyticsService,
            IReachabilityService reachabilityService,
            ILocationService locationService,
            IPostponeService postponeService)
            : base(reachabilityService, analyticsService, postponeService)
        {
            _apiService          = apiService;
            _exceptionPolicy     = exceptionPolicy;
            _analyticsService    = analyticsService;
            _locationService     = locationService;
            _reachabilityService = reachabilityService;

            _parameters = new Parameters();

            _locationService.LocationChanged       += (s, e) => UpdateData(UpdateEventInfos, false);
            _locationService.LocationStringChanged += (s, e) => UpdateLocationString();

            _reachabilityService.StateChanged += (s, e) => UpdateConnectedStatus().ContinueWithThrow();

            UpdateConnectedStatus().ContinueWithThrow();
            UpdateLocationString();
        }
コード例 #2
0
        protected NewsViewModel(IMvxNavigationService navigation
                                , IMvxMessenger messenger
                                , INewsService news
                                , IReachabilityService reachability
                                , IFeatureStore featureStore
                                , IBrowserService browser
                                , IDialogService dialog)
        {
            _navigation   = navigation;
            _messenger    = messenger;
            _news         = news;
            _reachability = reachability;
            _featureStore = featureStore;
            _browser      = browser;
            _dialog       = dialog;

            _stories = new MvxObservableCollection <StoryItemViewModel>();

            ShowStoryCommand = new MvxAsyncCommand <StoryItemViewModel>(OnShowStory, item => item.Filled && item.Story.Type == ItemType.Story);
            RefreshCommand   = new MvxAsyncCommand(LoadStories);

            ShowSettingsCommand = new MvxAsyncCommand(() => _navigation.Navigate <SettingsViewModel>());

            _fillerToken = messenger.Subscribe <NewsItemMessage>(OnItemReceived);

            TabPresentation = featureStore.IsEnabled(Features.StoryTabPresentation);
        }
コード例 #3
0
 public PostponeService(
     IConfiguration configuration,
     IReachabilityService reachabilityService)
 {
     PostponeTime         = configuration.PostponeTime;
     _reachabilityService = reachabilityService;
 }
コード例 #4
0
 public MockNewsViewModel(IMvxNavigationService navigation
                          , IMvxMessenger messenger
                          , INewsService news
                          , IReachabilityService reachability
                          , IFeatureStore featureStore
                          , IBrowserService browser
                          , IDialogService dialog)
     : base(navigation, messenger, news, reachability, featureStore, browser, dialog) =>
コード例 #5
0
 public EnvironmentService(
     IMvxPhoneCallTask phoneCallTask,
     IMvxComposeEmailTask composeEmailTask,
     IReachabilityService reachabilityService)
 {
     _phoneCallTask       = phoneCallTask;
     _composeEmailTask    = composeEmailTask;
     _reachabilityService = reachabilityService;
 }
コード例 #6
0
 protected RefreshableViewModel(
     IReachabilityService reachabilityService,
     IAnalyticsService analyticsService,
     IPostponeService postponeService)
     : base(analyticsService)
 {
     _reachabilityService = reachabilityService;
     _analyticsService    = analyticsService;
     _postponeService     = postponeService;
 }
コード例 #7
0
 public SmartWalkApiService(
     IHttpService httpService,
     ICacheService cacheService,
     IReachabilityService reachabilityService,
     IConfiguration configuration)
 {
     _httpService         = httpService;
     _cacheService        = cacheService;
     _reachabilityService = reachabilityService;
     _configuration       = configuration;
 }
コード例 #8
0
ファイル: LocationService.cs プロジェクト: showmap/smartwalk
        public LocationService(
            ISettings settings,
            IExceptionPolicyService exceptionPolicy,
            IReachabilityService reachabilityService,
            IEnvironmentService environmentService)
        {
            _settings            = settings;
            _exceptionPolicy     = exceptionPolicy;
            _environmentService  = environmentService;
            _reachabilityService = reachabilityService;
            _reachabilityService.StateChanged +=
                (s, e) => UpdateLocationString().ContinueWithThrow();

            _geocoder        = new CLGeocoder();
            _locationManager = new CLLocationManager();
            _locationManager.DesiredAccuracy       = CLLocation.AccuracyThreeKilometers;
            _locationManager.DistanceFilter        = 3000; // 3 Km
            _locationManager.AuthorizationChanged += OnAuthorizationChanged;

            SaveLocationSettings(CurrentLocation);
            UpdateLocationString().ContinueWithThrow();
        }