本文整理汇总了C#中Couchbase.Lite.Replication.Stop方法的典型用法代码示例。如果您正苦于以下问题:C# Replication.Stop方法的具体用法?C# Replication.Stop怎么用?C# Replication.Stop使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Couchbase.Lite.Replication
的用法示例。
在下文中一共展示了Replication.Stop方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: StopReplication
public void StopReplication(Replication replication)
{
var replicationDoneSignal = new CountdownEvent(1);
var replicationStoppedObserver = new ReplicationObserver(replicationDoneSignal);
replication.Changed += replicationStoppedObserver.Changed;
replication.Stop();
var success = replicationDoneSignal.Wait(TimeSpan.FromSeconds(30));
Assert.IsTrue(success);
// give a little padding to give it a chance to save a checkpoint
System.Threading.Thread.Sleep(2 * 1000);
}
示例2: RunReplication
private void RunReplication(Replication replication)
{
// var replicationDoneSignal = new CountDownLatch(1);
var replicationDoneSignalPolling = ReplicationWatcherThread(replication);
replication.Changed += (sender, e) =>
replicationDoneSignalPolling.CountDown ();
replication.Start();
Log.D(Tag, "Waiting for replicator to finish");
try
{
var success = replicationDoneSignalPolling.Await(TimeSpan.FromSeconds(15));
Assert.IsTrue(success);
Sharpen.Thread.Sleep(5000);
replication.Stop();
Log.D(Tag, "replicator finished");
}
catch (Exception e)
{
Runtime.PrintStackTrace(e);
}
}