private void QueryCompleted(object sender, QueryCompletedEventArgs e)
 {
     if (e.Rows.Count == 0)
     {
         var input = FindName("NewTodoBox") as TextBox;
         input.Focus();
     }
 }
コード例 #2
0
        public Task <QueryEnumerator> RunAsync(Func <QueryEnumerator> run, CancellationToken token)
        {
            return(Database.Manager.RunAsync(run, token)
                   .ContinueWith(runTask => // Raise the query's Completed event.
            {
                var error = runTask.Exception;

                var completed = Completed;
                if (completed != null)
                {
                    var args = new QueryCompletedEventArgs(runTask.Result, error);
                    completed(this, args);
                }

                if (runTask.Status != TaskStatus.RanToCompletion)
                {
                    throw runTask.Exception;       // Rethrow innner exceptions.
                }
                return runTask.Result;             // Give additional continuation functions access to the results task.
            }));
        }
コード例 #3
0
        /// <summary>
        /// Runs <see cref="Couchbase.Lite.Query"/> function asynchronously and
        /// will notified <see cref="Completed"/> event handlers on completion.
        /// </summary>
        /// <returns>The async task.</returns>
        /// <param name="run">Query's Run function</param>
        /// <param name="token">CancellationToken token.</param>
        public Task <QueryEnumerator> RunAsync(Func <QueryEnumerator> run, CancellationToken token)
        {
            return(Database.Manager.RunAsync(run, token)
                   .ContinueWith(runTask => // Raise the query's Completed event.
            {
                var error = runTask.Exception;

                var completed = _completed;
                if (completed != null)
                {
                    var args = new QueryCompletedEventArgs(runTask.Result, error);
                    completed(this, args);
                }

                if (error != null)
                {
                    Log.E(TAG, "Exception caught in runAsyncInternal", error);
                    throw error;         // Rethrow innner exceptions.
                }
                return runTask.Result;   // Give additional continuation functions access to the results task.
            }, Database.Manager.CapturedContext.Scheduler));
        }
コード例 #4
0
        /// <summary>
        /// Runs <see cref="Couchbase.Lite.Query"/> function asynchronously and
        /// will notified <see cref="Completed"/> event handlers on completion.
        /// </summary>
        /// <returns>The async task.</returns>
        /// <param name="run">Query's Run function</param>
        /// <param name="token">CancellationToken token.</param>
        public Task <QueryEnumerator> RunAsync(Func <QueryEnumerator> run, CancellationToken token)
        {
            return(Database.Manager.RunAsync(run, token)
                   .ContinueWith(runTask => // Raise the query's Completed event.
            {
                Log.To.Query.V(TAG, "Manager.RunAsync finished, processing results...");
                var error = runTask.Exception;
                var completed = _completed;
                if (completed != null)
                {
                    var args = new QueryCompletedEventArgs(runTask.Result, error);
                    completed(this, args);
                }

                if (error != null)
                {
                    Log.To.Query.E(TAG, String.Format("{0} exception in RunAsync", this), error);
                    throw error;         // Rethrow innner exceptions.
                }

                return runTask.Result;
            }, _eventContext.Scheduler));
        }
コード例 #5
0
        /// <summary>
        /// Runs <see cref="Couchbase.Lite.Query"/> function asynchronously and 
        /// will notified <see cref="Completed"/> event handlers on completion.
        /// </summary>
        /// <returns>The async task.</returns>
        /// <param name="run">Query's Run function</param>
        /// <param name="token">CancellationToken token.</param>
        public Task<QueryEnumerator> RunAsync(Func<QueryEnumerator> run, CancellationToken token) 
        {
            return Database.Manager.RunAsync(run, token)
                    .ContinueWith(runTask=> // Raise the query's Completed event.
                    {
                        var error = runTask.Exception;

                        var completed = _completed;
                        if (completed != null)
                        {
                            var args = new QueryCompletedEventArgs(runTask.Result, error);
                            completed(this, args);
                        }

                        if (error != null) {
                            Log.E(TAG, "Exception caught in runAsyncInternal", error);
                            throw error; // Rethrow innner exceptions.
                        }
                        return runTask.Result; // Give additional continuation functions access to the results task.
                    }, Database.Manager.CapturedContext.Scheduler);
        }
コード例 #6
0
        /// <summary>
        /// Runs <see cref="Couchbase.Lite.Query"/> function asynchronously and 
        /// will notified <see cref="Completed"/> event handlers on completion.
        /// </summary>
        /// <returns>The async task.</returns>
        /// <param name="run">Query's Run function</param>
        /// <param name="token">CancellationToken token.</param>
        public Task<QueryEnumerator> RunAsync(Func<QueryEnumerator> run, CancellationToken token) 
        {
            return Database.Manager.RunAsync(run, token)
                    .ContinueWith(runTask=> // Raise the query's Completed event.
                    {
                        Log.To.Query.V(TAG, "Manager.RunAsync finished, processing results...");
                        var error = runTask.Exception;
                        var completed = _completed;
                        if (completed != null) {
                            var args = new QueryCompletedEventArgs(runTask.Result, error);
                            completed(this, args);
                        }

                        if (error != null) {
                            Log.To.Query.E(TAG, String.Format("{0} exception in RunAsync", this), error);
                            throw error; // Rethrow innner exceptions.
                        }

                        return runTask.Result;
                    }, _eventContext.Scheduler);
        }
コード例 #7
0
ファイル: Query.cs プロジェクト: Redth/couchbase-lite-net
        public Task<QueryEnumerator> RunAsync(Func<QueryEnumerator> run, CancellationToken token) 
        {
            return Database.Manager.RunAsync(run, token)
                    .ContinueWith(runTask=> // Raise the query's Completed event.
                        {
                            var error = runTask.Exception;

                            var completed = Completed;
                            if (completed != null)
                            {
                                var args = new QueryCompletedEventArgs(runTask.Result, error);
                                completed(this, args);
                            }

                            if (runTask.Status != TaskStatus.RanToCompletion)
                                throw runTask.Exception; // Rethrow innner exceptions.

                            return runTask.Result; // Give additional continuation functions access to the results task.
                    });
        }