Ejemplo n.º 1
0
        /// <summary>Callback method for the async thread</summary>
        /// <param name="ar">Async result object</param>
        private void RunQueryCallback(IAsyncResult ar)
        {
            RunQueryDelegate dl = (RunQueryDelegate)((System.Runtime.Remoting.Messaging.AsyncResult)ar).AsyncDelegate;
            AsyncOperation async = (AsyncOperation)ar.AsyncState;
            ResultSet results;
            RunQueryCompletedEventArgs completedArgs = new RunQueryCompletedEventArgs(null, false, null);

            try
            {
                results = dl.EndInvoke(ar);
                completedArgs.Results = results;
            }
            catch(Exception ex)
            {
                completedArgs = new RunQueryCompletedEventArgs(ex, false, null);
            }
            finally
            {
                async.PostOperationCompleted(delegate(object e) { OnRunQueryCompleted((RunQueryCompletedEventArgs)e); }, completedArgs);
            }
        }
Ejemplo n.º 2
0
        /// <summary>Sets all the properties after the query completes</summary>
        private void RunQuery_Completed(object sender, RunQueryCompletedEventArgs e)
        {
            bool isError = true;
            if (e.Error == null)
            {
                _results.Data = e.Results.Data;
                _results.Messages = e.Results.Messages;
                isError = false;
            }
            else
            {
                _results.Messages = e.Error.Message;
            }

            if (this.Data != null && this.Data.SelectedDatabase != _oldDatabase)
            {
                App.OnDatabaseChanged(this, new ConnectionChangedEventArgs(null, this.Data.SelectedDatabase));
            }

            _results.OnPropertyChanged("Data");
            _results.OnPropertyChanged("Messages");
            _dab.RunQueryRowCreated -= this.RunQuery_InitialRowsCreatedAsync;
            RunQueryCompleted -= this.RunQuery_Completed;
            App.IsStopQueryEnabled = false;
            OnEndQuery(isError);
        }
Ejemplo n.º 3
0
 /// <summary>Triggers the RunQueryCompleted event</summary>
 protected virtual void OnRunQueryCompleted(RunQueryCompletedEventArgs e)
 {
     if (RunQueryCompleted != null)
     {
         RunQueryCompleted(this, e);
     }
 }