public MockGeoLocation(IStoredSettingsService storedSettingsService, IMvxMessenger messenger, IDataBaseService dataBaseService)
 {
     this._storedSettingsService = storedSettingsService;
     this._messenger             = messenger;
     this.dataBaseService        = dataBaseService;
     //getDataFromDataBase = true;
 }
Exemplo n.º 2
0
        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>();
        }
Exemplo n.º 3
0
        //List<MvxSubscriptionToken> _tokens = new List<MvxSubscriptionToken>();

        #region IGeoLocationWatcher implementation
        public DroidGeolocationWatcher(IStoredSettingsService storedSettingsService, IMvxMessenger messenger)
        {
            _storedSettingsService = storedSettingsService;
            _messenger             = messenger;
            ServiceIntent          = new Intent(ApplicationContext, typeof(GeolocationService));

            //_tokens.Add(_messenger.SubscribeOnThreadPoolThread<MotionMessage>(x =>
            //{
            //    Log.LogMessage($"[DroidGeolocationWatcher] 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($"[DroidGeolocationWatcher] Start geolocating because we are not still");
            //                StartGeolocationWatcher();
            //            }
            //            break;
            //        case MotionType.Still:
            //            if (IsBound)
            //            {
            //                Log.LogMessage($"[DroidGeolocationWatcher] Stop geolocating because we are still");
            //                StopGeolocationWatcher();
            //            }
            //            break;
            //    }
            //}));
        }
        public AddCreditCardViewModel(IPaymentProcessing paymentProcessing, IStoredSettingsService storedSettingsService)
        {
            this.paymentProcessing     = paymentProcessing;
            this.storedSettingsService = storedSettingsService;

            CloseAddCreditCardCommand = new MvxCommand(async() => { await CloseAsync(); });
            SaveCreditCardCommand     = new MvxCommand(async() => { await SaveCrediCardAsync(); });
        }
Exemplo n.º 5
0
        public HomeTestViewModel(IMvxMessenger messenger, ITrackFacade track, IGeoLocationWatcher geoWatcher, IStoredSettingsService storedSettingsService)
        {
            _track                 = track;
            _messenger             = messenger;
            _geoWatcher            = geoWatcher;
            _storedSettingsService = storedSettingsService;

            _tokens = new List <MvxSubscriptionToken>();
        }
        public RegistrationViewModel(IStoredSettingsService storedSettingsService, IServerApiService serverApiService)
        {
            this.storedSettingsService = storedSettingsService;
            this.serverApiService      = serverApiService;

            backToLoginViewCommand = new MvxCommand(() => { ShowViewModel <LoginViewModel>(); });
            registrationCommand    = new MvxCommand(() => ServerCommandWrapperAsync(() => RegistrationAsync()));
            validateCommand        = new MvxCommand(() => ComparePhoneCodeAsync());
        }
Exemplo n.º 7
0
        public RegistrationViewModel()
        {
            storedSettingsService = Mvx.Resolve <IStoredSettingsService>();
            serverApiService      = Mvx.Resolve <IServerApiService>();

            backToLoginViewCommand = new MvxCommand(() => { ShowViewModel <LoginViewModel>(); });
            registrationCommand    = new MvxCommand(() => ServerCommandWrapper(() => Registration()));
            validateCommand        = new MvxCommand(() => ComparePhoneCode());
        }
        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 LoginViewModel()
 {
     _storedSettingsService = Mvx.Resolve <IStoredSettingsService>();
     _facebookLoginService  = Mvx.Resolve <IFacebookLoginService>();
     _gPlusLoginService     = Mvx.Resolve <IGPlusLoginService>();
     _emailLoginCommand     = new MvxCommand(() => ServerCommandWrapper(() => LoginTask(EmailLoginData)));
     _facebookLoginCommand  = new MvxCommand(() => ServerCommandWrapper(async() => await LoginTask(await _facebookLoginService.GetPersonData())));
     _gPlusLoginCommand     = new MvxCommand(() => ServerCommandWrapper(async() => await LoginTask(await _gPlusLoginService.GetPersonData())));
     _registrationCommand   = new MvxCommand(() => { ShowViewModel <RegistrationViewModel>(); });
     _forgotPasswordCommand = new MvxCommand(() => { });
 }
Exemplo n.º 10
0
 public LoginViewModel(IStoredSettingsService storedSettingsService, IFacebookLoginService facebookLoginService, IGPlusLoginService gPlusLoginService,
                       IServerApiService serverApiService)
 {
     _storedSettingsService = storedSettingsService;
     _facebookLoginService  = facebookLoginService;
     _gPlusLoginService     = gPlusLoginService;
     _serverApiService      = serverApiService;
     _emailLoginCommand     = new MvxCommand(() => ServerCommandWrapperAsync(() => LoginTaskAsync(EmailLoginData)));
     _facebookLoginCommand  = new MvxCommand(() => ServerCommandWrapperAsync(async() => await LoginTaskAsync(await _facebookLoginService.GetPersonDataAsync())));
     _gPlusLoginCommand     = new MvxCommand(() => ServerCommandWrapperAsync(async() => await LoginTaskAsync(await _gPlusLoginService.GetPersonDataAsync())));
     _registrationCommand   = new MvxCommand(() => { ShowViewModel <RegistrationViewModel>(); });
     _forgotPasswordCommand = new MvxCommand(() => { });
 }
Exemplo n.º 11
0
 public GeoDataService()
 {
     try
     {
         _distanceChecker       = Mvx.Resolve <IDistanceChecker>();
         _dataBaseStorage       = Mvx.Resolve <IDataBaseService>();
         _serverApiService      = Mvx.Resolve <IServerApiService>();
         _storedSettingsService = Mvx.Resolve <IStoredSettingsService>();
     }
     catch (Exception ex)
     {
         Debug.WriteLine("Message:{0}\n StackTrace:{1}", ex.Message, ex.StackTrace);
     }
 }
Exemplo n.º 12
0
 public GeoDataService(IDistanceChecker distanceChecker, IDataBaseService dataBaseStorage, IServerApiService serverApiService, IStoredSettingsService storedSettingsService)
 {
     try
     {
         _distanceChecker       = distanceChecker;
         _dataBaseStorage       = dataBaseStorage;
         _serverApiService      = serverApiService;
         _storedSettingsService = storedSettingsService;
     }
     catch (Exception ex)
     {
         Debug.WriteLine("Message:{0}\n StackTrace:{1}", ex.Message, ex.StackTrace);
     }
 }
Exemplo n.º 13
0
        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;
        }
Exemplo n.º 14
0
        public VehicleViewModel(IStoredSettingsService storedSettingsService, IServerApiService serverApiService, IUserInteraction userInteraction)
        {
            this.storedSettingsService = storedSettingsService;
            this.serverApiService      = serverApiService;
            this.userInteraction       = userInteraction;

            GoBakToVehicleListCommnad = new MvxCommand(() => ShowViewModel <VehiclesDataViewModel>());
            AddVehicleCommnad         = new MvxCommand(async() => await AddVehicleAsync());
            CancelAddingCommnad       = new MvxCommand(async() =>
            {
                var result = await userInteraction.ConfirmAsync("Are you sure you want to cancel?", "Warning", "Yes", "No");
                if (result)
                {
                    ShowViewModel <VehiclesDataViewModel>();
                }
            });
        }
Exemplo n.º 15
0
        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");
        }
Exemplo n.º 16
0
        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 PayHistoryViewModel()
        {
            serverApiService      = Mvx.Resolve <IServerApiService>();
            storedSettingsService = Mvx.Resolve <IStoredSettingsService>();

            GetPayDateFrom = new DateTime(2016, 10, 5);
            GetPayDateTo   = DateTime.Now;

            backHomeCommand         = new MvxCommand(() => { ShowViewModel <HomeViewModel>(); });
            backToPayHistoryCommand = new MvxCommand(() => { ShowViewModel <PayHistoryViewModel>(); });

            openCalendarFromCommand = new MvxCommand(async() =>
            {
                GetPayDateFrom = await Mvx.Resolve <ICalendarDialog>().ShowDialog(GetPayDateFrom);
                await LoadHistory();
            });
            openCalendarToCommand = new MvxCommand(async() =>
            {
                GetPayDateTo = await Mvx.Resolve <ICalendarDialog>().ShowDialog(GetPayDateTo);
                await LoadHistory();
            });

            downloadHistoryCommand = new MvxCommand(() => ServerCommandWrapper(() => DownloadPdf()));
        }
Exemplo n.º 18
0
 public VehiclesDataViewModel(IStoredSettingsService storedSettingsService)
 {
     this.storedSettingsService = storedSettingsService;
     AddVehicleCommand          = new MvxCommand(() => ShowViewModel <VehicleViewModel>());
 }
Exemplo n.º 19
0
 public ProfileSettingService(IStoredSettingsService storedSettingsService, IServerApiService serverApiService)
 {
     this.storedSettingsService = storedSettingsService;
     this.serverApiService      = serverApiService;
 }
Exemplo n.º 20
0
 public WaypointChecker(IStoredSettingsService storedSettingsService)
 {
     this.storedSettingsService = storedSettingsService;
 }
Exemplo n.º 21
0
 public WaypointChecker()
 {
     storedSettingsService = Mvx.Resolve <IStoredSettingsService>();
     geoDataService        = Mvx.Resolve <IGeoDataService>();
     messenger             = Mvx.Resolve <IMvxMessenger>();
 }
 public PaymentProcessing(IStoredSettingsService storedSettingsService, IServerApiService serverApiService)
 {
     this.storedSettingsService = storedSettingsService;
     this.serverApiService      = serverApiService;
 }
 public TouchGeolocationWatcher(IStoredSettingsService storedSettingsService, IMvxMessenger messenger)
 {
     _storedSettingsService = storedSettingsService;
     _messenger             = messenger;
 }
 public SynchronisationService(IServerApiService serverApiService, IStoredSettingsService storedSettingsService, IPaymentProcessing paymentProcessing)
 {
     this.serverApiService      = serverApiService;
     this.storedSettingsService = storedSettingsService;
     this.paymentProcessing     = paymentProcessing;
 }
Exemplo n.º 25
0
 public ServerApiService(IStoredSettingsService storedSettingsService)
 {
     this.storedSettingsService = storedSettingsService;
 }
Exemplo n.º 26
0
 public SynchronisationService()
 {
     serverApiService      = Mvx.Resolve <IServerApiService>();
     storedSettingsService = Mvx.Resolve <IStoredSettingsService>();
 }
Exemplo n.º 27
0
 public ProfileSettingService()
 {
     storedSettingsService = Mvx.Resolve <IStoredSettingsService>();
 }
 public BatteryDrainService()
 {
     _geoWatcher            = Mvx.Resolve <IGeoLocationWatcher>();
     _storedSettingsService = Mvx.Resolve <IStoredSettingsService>();
     _motionActivity        = Mvx.Resolve <IMotionActivity>();
 }