Пример #1
0
        private void Dispose(bool finalizing)
        {
            DispatchQueue.DispatchSync(() =>
            {
                if (_disposed)
                {
                    return;
                }

                if (!finalizing)
                {
                    _nativeParams?.Dispose();
                    if (Status.Activity != ReplicatorActivityLevel.Stopped)
                    {
                        var newStatus = new ReplicatorStatus(ReplicatorActivityLevel.Stopped, Status.Progress, null);
                        _statusChanged.Fire(this, new ReplicatorStatusChangedEventArgs(newStatus));
                        Status = newStatus;
                    }
                }

                Stop();
                Native.c4repl_free(_repl);
                _repl     = null;
                _disposed = true;
            });
        }
Пример #2
0
        private void OnStatusChanged(ReplicatorStatusMessage message)
        {
            _status = message.Status;
            switch (message.Status.Activity)
            {
            case ReplicatorActivityLevel.Offline:
                _imageStatusReplication = "antenna_gray.png";
                break;

            case ReplicatorActivityLevel.Connecting:
                _imageStatusReplication = "import_export.png";
                break;

            case ReplicatorActivityLevel.Busy:
                _imageStatusReplication = "cached.png";
                break;

            case ReplicatorActivityLevel.Idle:
                _imageStatusReplication = "antenna_green.png";
                break;

            case ReplicatorActivityLevel.Stopped:
                _imageStatusReplication = "puce_gray_black.png";
                break;
            }
        }
Пример #3
0
        private void UpdateStateProperties(C4ReplicatorStatus state)
        {
            Exception error = null;

            if (state.error.code > 0)
            {
                error = CouchbaseException.Create(state.error);
            }

            _rawStatus = state;
            var level    = (ReplicatorActivityLevel)state.level;
            var progress = new ReplicatorProgress(state.progress.unitsCompleted, state.progress.unitsTotal);

            Status = new ReplicatorStatus(level, progress, error);
            WriteLog.To.Sync.I(Tag, $"{this} is {state.level}, progress {state.progress.unitsCompleted}/{state.progress.unitsTotal}");
        }
Пример #4
0
 internal ReplicatorStatusChangedEventArgs(ReplicatorStatus status)
 {
     Status = status;
 }
 public ReplicatorStatusMessage(Couchbase.Lite.Sync.ReplicatorStatus status, string le)
 {
     Status    = status;
     LastError = le;
 }