Esempio n. 1
0
        protected Session GetSession(Realm realm)
        {
            var result = realm.GetSession();

            CleanupOnTearDown(result);
            return(result);
        }
Esempio n. 2
0
        public static async Task WaitForSyncAsync(Realm realm, bool upload = true, bool download = true)
        {
            var session = realm.GetSession();

            try
            {
                if (upload)
                {
                    await session.WaitForUploadAsync();
                }

                if (upload && download)
                {
                    await Task.Delay(50);
                }

                if (download)
                {
                    await session.WaitForDownloadAsync();
                }
            }
            finally
            {
                session.CloseHandle();
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Waits for upload and immediately disposes of the managed handle to ensure the Realm can be safely deleted.
        /// </summary>
        protected async Task WaitForUploadAsync(Realm realm)
        {
            var session = realm.GetSession();
            await session.WaitForUploadAsync();

            session.CloseHandle();
        }
Esempio n. 4
0
        public SyncingManager(ISyncConfigurationsProvider configurationsProvider)
        {
            _realm = Realm.GetInstance(configurationsProvider.ActiveConfiguration);

            var session             = _realm.GetSession();
            var downloadsObservable =
                session.GetProgressObservable(ProgressDirection.Download, ProgressMode.ReportIndefinitely);

            _token  = downloadsObservable.Subscribe(this);
            _source = new CancellationTokenSource();
        }