Exemplo n.º 1
0
        /// <summary>
        /// Stops the replication
        /// </summary>
        public void Stop()
        {
            DispatchQueue.DispatchSync(() =>
            {
                if (_stopping)
                {
                    return;
                }

                _stopping = true;
                _reachability?.Stop();
                _reachability = null;
                if (_repl != null)
                {
                    Native.c4repl_stop(_repl);
                }
                else if (_rawStatus.level == C4ReplicatorActivityLevel.Offline)
                {
                    StatusChangedCallback(new C4ReplicatorStatus
                    {
                        level = C4ReplicatorActivityLevel.Stopped
                    });
                }
            });
        }
Exemplo n.º 2
0
        public GatewayPollingService(
            IDeviceInfo deviceInfo,
            IHttpService httpService,
            IReachability reachability,
            IRepositories repositories,
            IMvxMessenger messenger,
            IGatewayService gatewayService,
            IGatewayQueuedService gatewayQueuedService,
            IInfoService infoService,
            IDataChunkService dataChunkService,
            ICustomPresenter customPresenter,
            ILoggingService loggingService
            )
        {
            _deviceInfo           = deviceInfo;
            _httpService          = httpService;
            _reachability         = reachability;
            _repositories         = repositories;
            _messenger            = messenger;
            _gatewayService       = gatewayService;
            _gatewayQueuedService = gatewayQueuedService;
            _infoService          = infoService;
            _dataChunkService     = dataChunkService;
            _customPresenter      = customPresenter;

            _deviceRepository = repositories.DeviceRepository;
            _loggingService   = loggingService;
        }
Exemplo n.º 3
0
        // Must be called from within the ThreadSafety
        private void StatusChangedCallback(C4ReplicatorStatus status)
        {
            if (_disposed)
            {
                return;
            }

            if (status.level == C4ReplicatorActivityLevel.Stopped)
            {
                if (HandleError(status.error))
                {
                    status.level = C4ReplicatorActivityLevel.Offline;
                }
            }
            else if (status.level > C4ReplicatorActivityLevel.Connecting)
            {
                _retryCount = 0;
                _reachability?.Stop();
                _reachability = null;
            }

            UpdateStateProperties(status);
            if (status.level == C4ReplicatorActivityLevel.Stopped)
            {
                ClearRepl();
                Config.Database.ActiveReplications.Remove(this);
            }

            try {
                _statusChanged.Fire(this, new ReplicatorStatusChangedEventArgs(Status));
            } catch (Exception e) {
                Log.To.Sync.W(Tag, "Exception during StatusChanged callback", e);
            }
        }
Exemplo n.º 4
0
 private void StopReachabilityObserver()
 {
     if (_reachability != null)
     {
         _reachability.StatusChanged -= ReachabilityChanged;
         _reachability.Stop();
         _reachability = null;
     }
 }
Exemplo n.º 5
0
 public TrailerListViewModel(IGatewayService gatewayService,
                             IRepositories repositories,
                             IReachability reachabibilty,
                             IToast toast,
                             IInfoService infoService,
                             INavigationService navigationService) : base(gatewayService, repositories, reachabibilty, toast, infoService, navigationService)
 {
     _applicationProfileRepository = repositories.ApplicationRepository;
 }
Exemplo n.º 6
0
        private void StartReachabilityObserver()
        {
            if (_reachability != null)
            {
                return;
            }

            _reachability = Service.GetInstance <IReachability>() ?? new Reachability();
            _reachability.StatusChanged += ReachabilityChanged;
            _reachability.Start();
        }
Exemplo n.º 7
0
        public BaseTrailerListViewModel(IGatewayService gatewayService, IRepositories repositories, IReachability reachabilty, IToast toast, IInfoService infoService, INavigationService navigationService)
        {
            _reachability      = reachabilty;
            _toast             = toast;
            _infoService       = infoService;
            _navigationService = navigationService;
            _gatewayService    = gatewayService;
            _repositories      = repositories;

            ProgressMessage = "Updating Trailers.";
        }
Exemplo n.º 8
0
 public DiagnosticsViewModel(IReachability reachability, IDataService dataService, IRepositories repositories, ICustomUserInteraction userInteraction, INavigationService navigationService, IDiagnosticsService diagnosticsService, IDeviceInfo deviceInfo)
 {
     _dataService                  = dataService;
     _reachability                 = reachability;
     _userInteraction              = userInteraction;
     _navigationService            = navigationService;
     _diagnosticsService           = diagnosticsService;
     _applicationProfileRepository = repositories.ApplicationRepository;
     _configRepository             = repositories.ConfigRepository;
     _deviceInfo = deviceInfo;
 }
Exemplo n.º 9
0
 public InstructionTrailerViewModel(IGatewayService gatewayService,
                                    INavigationService navigationService,
                                    IRepositories repositories,
                                    IReachability reachabiity,
                                    IToast toast,
                                    IInfoService startUpService)
     : base(gatewayService, repositories, reachabiity, toast, startUpService, navigationService)
 {
     _notificationToken            = Messenger.Subscribe <Messages.GatewayInstructionNotificationMessage>(async m => await CheckInstructionNotificationAsync(m));
     _applicationProfileRepository = _repositories.ApplicationRepository;
 }
Exemplo n.º 10
0
 /// <summary>
 /// Stops the replication
 /// </summary>
 public void Stop()
 {
     _threadSafetyQueue.DispatchSync(() =>
     {
         _reachability?.Stop();
         _reachability = null;
         if (_repl != null)
         {
             Native.c4repl_stop(_repl);
         }
     });
 }
Exemplo n.º 11
0
 public DiagnosticsService(
     Repositories.IRepositories repositories,
     ILoggingService loggingService,
     IReachability reachability,
     IDeviceInfo deviceInfo,
     IUpload upload)
 {
     _repositories   = repositories;
     _loggingService = loggingService;
     _reachability   = reachability;
     _deviceInfo     = deviceInfo;
     _upload         = upload;
 }
Exemplo n.º 12
0
 public ImageUploadService(
     Repositories.IRepositories repositories,
     IGpsService gpsService,
     ILoggingService loggingService,
     IReachability reachability,
     IHttpService httpService)
 {
     _repositories   = repositories;
     _gpsService     = gpsService;
     _loggingService = loggingService;
     _reachability   = reachability;
     _httpService    = httpService;
 }
Exemplo n.º 13
0
        public LoggingService(
            IRepositories repositories,
            IGatewayService gatewayService,
            IDeviceInfo deviceInfo,
            IReachability reachability,
            ICloseApplication closeApplication)
        {
            _loggedRepository = repositories.LogMessageRepository;
            _gatewayService   = gatewayService;
            _deviceInfo       = deviceInfo;
            _reachability     = reachability;
            _closeApplication = closeApplication;

            _notificationToken = Mvx.Resolve <IMvxMessenger>().Subscribe <Messages.TopLevelExceptionHandlerMessage>(async m =>
                                                                                                                    await this.LogAndCloseAsync(m.TopLevelException)
                                                                                                                    );
        }
Exemplo n.º 14
0
        /// <summary>
        /// Stops the replication
        /// </summary>
        public void Stop()
        {
            DispatchQueue.DispatchSync(() =>
            {
                if (_stopping)
                {
                    return;
                }

                _stopping = true;
                _reachability?.Stop();
                _reachability = null;
                if (_repl != null)
                {
                    Native.c4repl_stop(_repl);
                }
            });
        }
Exemplo n.º 15
0
        public ManifestViewModel(IRepositories repositories, INavigationService navigationService, IReachability reachability, IToast toast,
                                 IGatewayPollingService gatewayPollingService, IGatewayQueuedService gatewayQueuedService, IInfoService infoService)
        {
            _mobileDataRepository         = repositories.MobileDataRepository;
            _applicationProfileRepository = repositories.ApplicationRepository;

            _navigationService     = navigationService;
            _reachability          = reachability;
            _toast                 = toast;
            _gatewayPollingService = gatewayPollingService;
            _gatewayQueuedService  = gatewayQueuedService;
            _infoService           = infoService;

            _initialised = true;

            Mvx.Resolve <ICheckForSoftwareUpdates>().Check();

            CreateSections();
        }
Exemplo n.º 16
0
        private void StartReachabilityObserver()
        {
            if (_reachability != null)
            {
                return;
            }

            var remoteUrl = (Config.Target as URLEndpoint)?.Url;

            if (remoteUrl == null)
            {
                return;
            }

            _reachability = Service.GetInstance <IReachability>() ?? new Reachability();
            _reachability.StatusChanged += ReachabilityChanged;
            _reachability.Url            = remoteUrl;
            _reachability.Start();
        }
Exemplo n.º 17
0
        public CustomerCodeViewModel(IGatewayService gatewayService, IReachability reachability, IDataService dataService, IRepositories repositories, ICustomUserInteraction userInteraction, INavigationService navigationService, ICloseApplication closeApplication)
        {
            _gatewayService    = gatewayService;
            _dataService       = dataService;
            _reachability      = reachability;
            _userInteraction   = userInteraction;
            _navigationService = navigationService;

            _applicationProfileRepository = repositories.ApplicationRepository;
            _customerRepository           = repositories.CustomerRepository;
            _deviceRepository             = repositories.DeviceRepository;
            _driverRepository             = repositories.DriverRepository;
            _safetyProfileRepository      = repositories.SafetyProfileRepository;
            _trailerRepository            = repositories.TrailerRepository;
            _vehicleRepository            = repositories.VehicleRepository;
            _verbProfileRepository        = repositories.VerbProfileRepository;
            _configRepository             = repositories.ConfigRepository;
            _closeApplication             = closeApplication;
        }
Exemplo n.º 18
0
        public VehicleListViewModel(
            IGatewayService gatewayService,
            IVehicleRepository vehicleRepository,
            IReachability reachabibilty,
            IToast toast,
            IInfoService infoService,
            INavigationService navigationService,
            ICurrentDriverRepository currentDriverRepository,
            ILoggingService loggingService,
            ISafetyProfileRepository safetyProfileRepository)
        {
            _toast        = toast;
            _reachability = reachabibilty;

            _gatewayService    = gatewayService;
            _infoService       = infoService;
            _navigationService = navigationService;
            _loggingService    = loggingService;

            _currentDriverRepository = currentDriverRepository;
            _vehicleRepository       = vehicleRepository;
            _safetyProfileRepository = safetyProfileRepository;
        }
Exemplo n.º 19
0
 public AuthenticationService(IDriverRepository driverRepository, IReachability reachability, IGatewayService gatewayService)
 {
     _driverRepository = driverRepository;
     _reachability     = reachability;
     _gatewayService   = gatewayService;
 }
Exemplo n.º 20
0
 private void StopReachabilityObserver()
 {
     _reachability?.Stop();
     _reachability = null;
 }