protected Session GetSession(Realm realm) { var result = realm.GetSession(); CleanupOnTearDown(result); return(result); }
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(); } }
/// <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(); }
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(); }