Beispiel #1
0
        private void backgroundWorker1_ProgressChanged(object sender, ProgressChangedEventArgs e)
        {
            SearhProgressState _obj = e.UserState as SearhProgressState;

            if (!_queryCanceled)
            {
                this.labelState.Text = _obj.Message;
            }
            else
            {
                this.labelState.Text = "正在取消搜索,请稍候 ....";
            }
            if (_obj.ResultData != null)
            {
                this.sinoCommonGrid1.BeginUpdate();
                foreach (MDSearch_ResultDataIndex _rd in _obj.ResultData)
                {
                    _searchResult.Add(_rd);
                }
                this.sinoCommonGrid1.DataSource = _searchResult;
                this.sinoCommonGrid1.EndUpdate();
            }

            this.progressBarControl1.Position = e.ProgressPercentage;
        }
Beispiel #2
0
        private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
        {
            SearhProgressState _stateobj;

            _searchResult = new List <MDSearch_ResultDataIndex>();
            List <MDSearch_Column> _searchColumns = new List <MDSearch_Column>();

            using (MetaDataQueryServiceClient _msc = new MetaDataQueryServiceClient())
            {
                foreach (MD_QueryModel _qm in _selectModels)
                {
                    List <MDSearch_Column> _columns = _msc.GetSearchResultColumn(_searchText, _searchType, _searchConceptGroup,
                                                                                 _qm.FullName).ToList <MDSearch_Column>();
                    foreach (MDSearch_Column _sc in _columns)
                    {
                        _sc.QueryModel = _qm;
                        _searchColumns.Add(_sc);
                    }
                }
            }
            decimal i      = 0;
            decimal _count = Convert.ToDecimal(_searchColumns.Count);
            List <MDSearch_ResultDataIndex> _resultData = null;

            using (MetaDataQueryServiceClient _msc = new MetaDataQueryServiceClient())
            {
                foreach (MDSearch_Column _sc in _searchColumns)
                {
                    string  _str      = string.Format("正在搜索:[{0}]数据源中的{1} ....", _sc.QueryModel.DisplayTitle, string.Format("[{0}].[{1}]", _sc.TableTitle, _sc.ColumnTitle));
                    decimal _progress = i / _count * 100;
                    _stateobj = new SearhProgressState(_str, null);
                    this.backgroundWorker1.ReportProgress(Convert.ToInt32(_progress), _stateobj);
                    _resultData = _msc.GetSearchResult(_searchText, _searchType, _sc).ToList <MDSearch_ResultDataIndex>();
                    _stateobj   = new SearhProgressState(_str, _resultData);
                    this.backgroundWorker1.ReportProgress(Convert.ToInt32(_progress), _stateobj);
                    i++;
                }
            }
        }