Пример #1
0
        private void GetListAsyncCompleted(object state)
        {
            m_busy = false;
            if (GetListCompleted == null)
            {
                return;
            }
            GetListAsyncCompletedEventArgs _EventArgs = (GetListAsyncCompletedEventArgs)state;

            try
            {
                GetListCompleted(this, _EventArgs);
            }
            catch (Exception ex)
            {
                m_Context.Log.WriteLine(String.Format("Exception {0} at GetListAsyncCompleted", ex.Message));
            }
            finally { m_busy = false; }
        }
Пример #2
0
        /// <summary>
        /// This method performs the actual workload to gets the list.
        /// </summary>
        /// <param name="listName">Name of the list.</param>
        /// <param name="asyncOp">The _ asynchronous property.</param>
        private void GetListAsyncWorker <TEntity>(string listName, CamlQuery camlQuery, AsyncOperation asyncOp, SendOrPostCallback onCompletedDelegate)
            where TEntity : class, ITrackEntityState, ITrackOriginalValues, INotifyPropertyChanged, INotifyPropertyChanging, new()
        {
            Exception      _Exception = null;
            List <TEntity> _Result    = null;

            try
            {
                _Result = m_Context.GetList <TEntity>(listName).Filter <TEntity>(camlQuery).ToList <TEntity>();
            }
            catch (Exception ex)
            {
                _Exception = ex;
            }
            // Package the results of the operation in a  GetListAsyncCompletedEventArgs.
            GetListAsyncCompletedEventArgs e = new GetListAsyncCompletedEventArgs(_Result, _Exception, false, asyncOp.UserSuppliedState);

            // End the task. The asyncOp object is responsible for marshaling the call.
            asyncOp.PostOperationCompleted(onCompletedDelegate, e);
        }