示例#1
0
 /// <summary>
 /// 引发<see cref="DataLoading"/>事件
 /// </summary>
 public void OnDataLoading(DataLoadingEventArgs e)
 {
     if (DataLoading != null)
     {
         DataLoading(this, e);
     }
 }
示例#2
0
 private void SearchManager_DataLoading(object sender, DataLoadingEventArgs e)
 {
     if (!TryCancelEdit())
     {
         e.Cancel = true;
     }
     else
     {
         this.m_inOperating = false;
         this.State         = StateType.View;
     }
 }
示例#3
0
        /// <summary>
        /// 根据查询条件查询数据,并设置查询历史,引发<see cref="DataLoading"/>和<see cref="DataLoaded"/>事件
        /// </summary>
        /// <param name="searchExpression"></param>
        /// <param name="searchOrders"></param>
        public void LoadData(ISearchExpression searchExpression, IList <ISearchOrder> searchOrders)
        {
            lock (m_syncObject)
            {
                //if (m_loadingThread != null && m_loadingThread.IsAlive)
                //{
                //    m_loadingThread.Abort();
                //    m_loadingThread.Join();
                //}

                //if (m_isDataLoding)
                //{
                //    throw new InvalidUserOperationException("请先停止搜索才能重新开始搜索!");
                //}

                // Reload也调用此函数,不能在这里设置
                //this.FirstResult = 0;


                if (m_asyncManager != null && m_asyncManager.IsWorkerBusy)
                {
                    return;
                }

                SetHistory(searchExpression, searchOrders);

                this.FillSearchAdditionals(ref searchExpression, ref searchOrders);

                DisposeAsyncManager();

                DataLoadingEventArgs e = new DataLoadingEventArgs(searchExpression, searchOrders);
                OnDataLoading(e);

                if (e.Cancel)
                {
                    return;
                }

                //if (m_loadingThread != null && m_loadingThread.IsAlive)
                //{
                //    m_loadingThread.Abort();
                //}

                //// 线程运行了就不能重新启动,要重新建一个
                //m_loadingThread = new Thread(new ParameterizedThreadStart(ThreadLoadData));
                //m_loadingThread.IsBackground = true;

                //if (asyncOperation == null)
                //{
                //    this.asyncOperation = System.ComponentModel.AsyncOperationManager.CreateOperation(null);
                //    this.operationCompleted = new SendOrPostCallback(this.AsyncOperationCompleted);
                //}

                //m_isDataLoding = true;

                //m_loadingThread.Start(e);

                InitAsyncManager(e);

                m_asyncManager.StartWorker(SystemConfiguration.UseMultiThread);
            }
        }
示例#4
0
 private void InitAsyncManager(DataLoadingEventArgs e)
 {
     m_asyncManager                 = new AsyncManager <object, DataLoadedEventArgs>(this.Name, new DataLoadWorker(this, e));
     m_asyncManager.WorkerDone     += new EventHandler <WorkerDoneEventArgs <DataLoadedEventArgs> >(LoadWork_WorkerDone);
     m_asyncManager.WorkerProgress += new EventHandler <WorkerProgressEventArgs <object> >(m_asyncManager_WorkerProgress);
 }
 private void SearchManager_DataLoading(object sender, DataLoadingEventArgs e)
 {
     if (!TryCancelEdit())
     {
         e.Cancel = true;
     }
     else
     {
         this.m_inOperating = false;
         this.State = StateType.View;
     }
 }
        private void searchManager_DataLoading(object sender, DataLoadingEventArgs e)
        {
            if (e.Cancel)
                return;

            ISearchManager sm = sender as ISearchManager;
            if (progressForm == null)
            {
                progressForm = new ProgressForm();
                progressForm.ProgressStopped += new EventHandler(progressForm_ProgressStopped);
            }
            System.Threading.Interlocked.Increment(ref m_progressDoings);
            if (!progressForm.IsActive)
            {
                progressForm.Start(this, "查找");
            }
        }