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
        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.
                    });
        }