当前位置: 首页>>代码示例>>C#>>正文


C# Replication.Start方法代码示例

本文整理汇总了C#中Couchbase.Lite.Replication.Start方法的典型用法代码示例。如果您正苦于以下问题:C# Replication.Start方法的具体用法?C# Replication.Start怎么用?C# Replication.Start使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Couchbase.Lite.Replication的用法示例。


在下文中一共展示了Replication.Start方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: UpdateReplications

        private void UpdateReplications(string syncURL)
        {
            
            if (_puller != null)
            {
                _puller.Stop();
            }

            if(_pusher != null)
            {
                _pusher.Stop();
            }

            if (String.IsNullOrEmpty(syncURL))
            {
                return;
            }

            var uri = new Uri(syncURL);
            _puller = _db.CreatePullReplication(uri);
            _puller.Continuous = true;
            _puller.Start();

            _pusher = _db.CreatePushReplication(uri);
            _pusher.Continuous = true;
            _pusher.Start();
        }
开发者ID:jonfunkhouser,项目名称:couchbase-lite-net,代码行数:27,代码来源:MainPage.xaml.cs

示例2: Start

	private IEnumerator Start () {
		Debug.LogFormat ("Data path = {0}", Application.persistentDataPath);

#if UNITY_EDITOR_WIN
		Log.SetLogger(new UnityLogger());
#endif
		_db = Manager.SharedInstance.GetDatabase ("spaceshooter");
		_pull = _db.CreatePullReplication (GameController.SYNC_URL);
		_pull.Continuous = true;
		_pull.Start ();
		while (_pull != null && _pull.Status == ReplicationStatus.Active) {
			yield return new WaitForSeconds(0.5f);
		}

		var doc = _db.GetExistingDocument ("player_data");
		if (doc != null) {
			//We have a record!  Get the ship data, if possible.
			string assetName = String.Empty;
			if(doc.UserProperties.ContainsKey("ship_data")) {
				assetName = doc.UserProperties ["ship_data"] as String;
			}
			StartCoroutine(LoadAsset (assetName));
		} else {
			//Create a new record
			doc = _db.GetDocument("player_data");
			doc.PutProperties(new Dictionary<string, object> { { "ship_data", String.Empty } });
		}

		doc.Change += DocumentChanged;
		_push = _db.CreatePushReplication (new Uri ("http://127.0.0.1:4984/spaceshooter"));
		_push.Start();
	}
开发者ID:serjee,项目名称:space-shooter,代码行数:32,代码来源:AssetChangeListener.cs

示例3: StartSync

        public void StartSync(string syncUrl)
        {
            Uri uri;
            try {
                uri = new Uri(syncUrl);
            } catch(UriFormatException) {
                Log.E("TaskManager", "Invalid URL {0}", syncUrl);
                return;
            }

            if(_pull == null) {
                _pull = _db.CreatePullReplication(uri);
                _pull.Continuous = true;
                _pull.Start();
            }

            if(_push == null) {
                _push = _db.CreatePushReplication(uri);
                _push.Continuous = true;
                _push.Start();
            }
        }
开发者ID:richardkeller411,项目名称:dev-days-labs,代码行数:22,代码来源:TaskManager.cs

示例4: RunReplication

        private void RunReplication(Replication replication)
        {
            var replicationDoneSignal = new CountDownLatch(1);
            var observer = new ReplicationObserver(replicationDoneSignal);
            replication.Changed += observer.Changed;
            replication.Start();

            var replicationDoneSignalPolling = ReplicationWatcherThread(replication);

            Log.D(Tag, "Waiting for replicator to finish.");

                var success = replicationDoneSignal.Await(TimeSpan.FromSeconds(15));
                Assert.IsTrue(success);
                success = replicationDoneSignalPolling.Wait(TimeSpan.FromSeconds(15));
                Assert.IsTrue(success);

                Log.D(Tag, "replicator finished");

            replication.Changed -= observer.Changed;
        }
开发者ID:FireflyLogic,项目名称:couchbase-lite-net,代码行数:20,代码来源:ReplicationTest.cs

示例5: DoReplication

    IEnumerator DoReplication(Replication replication)
    {
        replication.Start ();

        while (replication != null && replication.Status == ReplicationStatus.Active) {
            yield return new WaitForSeconds(0.5f);
        }
    }
开发者ID:lesterlecong,项目名称:UpVenture,代码行数:8,代码来源:CouchbaseDatabase.cs

示例6: UpdateSyncUrl

    void UpdateSyncUrl ()
    {
        if (Database == null)
            return;

        Uri newRemoteUrl = null;
        var syncPoint = NSUserDefaults.StandardUserDefaults.StringForKey (ConfigViewController.SyncUrlKey);
        if (!String.IsNullOrWhiteSpace (syncPoint))
            newRemoteUrl = new Uri (syncPoint);
        else
            return;
        ForgetSync ();

        pull = Database.CreatePullReplication (newRemoteUrl);
            push = Database.CreatePushReplication (newRemoteUrl);
        pull.Continuous = push.Continuous = true;
        pull.Changed += ReplicationProgress;
        push.Changed += ReplicationProgress;
        pull.Start();
        push.Start();
    }
开发者ID:transformersprimeabcxyz,项目名称:_TO-DO-couchbase-lite-net-couchbase,代码行数:21,代码来源:RootViewController.cs

示例7: RunReplication

        protected virtual void RunReplication(Replication replication)
        {
            var replicationDoneSignal = new CountdownEvent(1);
            var observer = new ReplicationObserver(replicationDoneSignal);
            replication.Changed += observer.Changed;
            replication.Start();
            var success = replicationDoneSignal.Wait(TimeSpan.FromSeconds(60));
            Assert.IsTrue(success);

            replication.Changed -= observer.Changed;
        }
开发者ID:wilsondy,项目名称:couchbase-lite-net,代码行数:11,代码来源:LiteTestCase.cs

示例8: RunReplication

		private void RunReplication(Replication replication)
		{
			CountDownLatch replicationDoneSignal = new CountDownLatch(1);
			ReplicationTest.ReplicationObserver replicationObserver = new ReplicationTest.ReplicationObserver
				(this, replicationDoneSignal);
			replication.AddChangeListener(replicationObserver);
			replication.Start();
			CountDownLatch replicationDoneSignalPolling = ReplicationWatcherThread(replication
				);
			Log.D(Tag, "Waiting for replicator to finish");
			try
			{
				bool success = replicationDoneSignal.Await(300, TimeUnit.Seconds);
				NUnit.Framework.Assert.IsTrue(success);
				success = replicationDoneSignalPolling.Await(300, TimeUnit.Seconds);
				NUnit.Framework.Assert.IsTrue(success);
				Log.D(Tag, "replicator finished");
			}
			catch (Exception e)
			{
				Sharpen.Runtime.PrintStackTrace(e);
			}
		}
开发者ID:Redth,项目名称:couchbase-lite-net,代码行数:23,代码来源:ReplicationTest.cs

示例9: RunReplication

        protected override void RunReplication(Replication replication)
        {
            var replicationDoneSignal = new CountdownEvent(1);
            var observer = new ReplicationObserver(replicationDoneSignal);
            replication.Changed += observer.Changed;
            replication.Start();

            var replicationDoneSignalPolling = ReplicationWatcherThread(replication);

            var success = replicationDoneSignal.Wait(TimeSpan.FromSeconds(15));
            Assert.IsTrue(success);
            success = replicationDoneSignalPolling.Wait(TimeSpan.FromSeconds(15));
            Assert.IsTrue(success);

            replication.Changed -= observer.Changed;
        }
开发者ID:JackWangCUMT,项目名称:couchbase-lite-net,代码行数:16,代码来源:PerformanceTestCase.cs

示例10: StartPushChanges

 void StartPushChanges()
 {
     string uri =  "http://" + hostName + ":" + portNumber.ToString() + "/" + databaseName;
     pushReplication = database.CreatePushReplication (new Uri (uri));
     pushReplication.Start ();
 }
开发者ID:lesterlecong,项目名称:Assets,代码行数:6,代码来源:CouchbaseDatabase.cs

示例11: StartReplication

	void StartReplication ()
	{
		if (StringEx.IsNullOrWhiteSpace (replicationUrl)) {
			Log.E (TAG, "Replication URL not set");
			return;
		}

		_puller = _db.CreatePullReplication (new Uri(replicationUrl));
		_puller.Continuous = true;
		_puller.Changed += (sender, e) => {
			Log.D (TAG, "Puller: " + _puller.LastError == null ? "Okay" : _puller.LastError.Message);
		};

		_pusher = _db.CreatePushReplication (new Uri(replicationUrl));
		_pusher.Continuous = true;
		_pusher.Changed += (sender, e) => {
			Log.D (TAG, "Pusher: " + _pusher.LastError == null ? "Okay" : _pusher.LastError.Message);
		};

		_pusher.Start ();
		_puller.Start ();

		Log.D (TAG, "Started replication with " + replicationUrl);
	}
开发者ID:transformersprimeabcxyz,项目名称:_TO-DO-couchbase-lite-net-couchbase,代码行数:24,代码来源:TestScript.cs

示例12: 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);
			}
		}
开发者ID:Redth,项目名称:couchbase-lite-net,代码行数:23,代码来源:ReplicationTest.cs

示例13: UpdateSync

        private void UpdateSync()
        {
            if (Database == null)
                return;

            var preferences = PreferenceManager.GetDefaultSharedPreferences(this);
            var syncUrl = preferences.GetString("sync-gateway-url", null);

            ForgetSync ();

            if (!String.IsNullOrEmpty(syncUrl))
            {
                try 
                {
                    var uri = new System.Uri(syncUrl);
                    Pull = Database.CreatePullReplication(uri);
                    Pull.Continuous = true;
                    Pull.Changed += ReplicationChanged;

                    Push = Database.CreatePushReplication(uri);
                    Push.Continuous = true;
                    Push.Changed += ReplicationChanged;

                    Pull.Start();
                    Push.Start();
                } 
                catch (Java.Lang.Throwable th)
                {
                    Log.Debug(Tag, th, "UpdateSync Error");
                }
            }
        }
开发者ID:jonlipsky,项目名称:couchbase-lite-net,代码行数:32,代码来源:MainActivity.cs

示例14: StartSyncGateway

        public void StartSyncGateway(string url = "")
        {
            pull = _database.CreatePullReplication(CreateSyncUri());
            push = _database.CreatePushReplication(CreateSyncUri());

            var authenticator = AuthenticatorFactory.CreateBasicAuthenticator("david", "12345");
            pull.Authenticator = authenticator;
            push.Authenticator = authenticator;

            pull.Continuous = true;
            push.Continuous = true;

            pull.Changed += Pull_Changed;
            push.Changed += Push_Changed;

            pull.Start();
            push.Start();
        }
开发者ID:Branor,项目名称:CouchbaseLite-Delphi-ComInterop,代码行数:18,代码来源:CouchbaseLiteFacade.cs

示例15: TestIssue490

        public void TestIssue490()
        {
            var sg = new CouchDB("http", GetReplicationServer());
            using (var remoteDb = sg.CreateDatabase("issue490")) {

                var push = database.CreatePushReplication(remoteDb.RemoteUri);
                CreateFilteredDocuments(database, 30);
                CreateNonFilteredDocuments (database, 10);
                RunReplication(push);
                Assert.IsTrue(push.ChangesCount==40);
                Assert.IsTrue(push.CompletedChangesCount==40);

                Assert.IsNull(push.LastError);
                Assert.AreEqual(40, database.DocumentCount);

                for (int i = 0; i <= 5; i++) {
                    pull = database.CreatePullReplication(remoteDb.RemoteUri);
                    pull.Continuous = true;
                    pull.Start ();
                    Task.Delay (1000).Wait();
                    CallToView ();
                    Task.Delay (2000).Wait();
                    RecreateDatabase ();
                }
            }

        }
开发者ID:JackWangCUMT,项目名称:couchbase-lite-net,代码行数:27,代码来源:ViewsTest.cs


注:本文中的Couchbase.Lite.Replication.Start方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。