protected override void LoadObjectData(MB.Util.Model.QueryParameterInfo[] queryParams)
        {
            if (_ClientRuleObject == null)
            {
                throw new MB.Util.APPException("在加载浏览窗口<DefaultViewForm>时 需要配置对应的ClientRule 类!");
            }

            if (_ClientRuleObject.ClientLayoutAttribute == null)
            {
                throw new MB.Util.APPException(string.Format("对于客户段逻辑类 {0} ,需要配置 RuleClientLayoutAttribute.", _ClientRuleObject.GetType().FullName));
            }

            ITreeListViewHoster treeListHoster = _TreeListHoster;

            try {
                using (MB.WinBase.WaitCursor cursor = new MB.WinBase.WaitCursor(this)) {
                    if (_ClientRuleObject.ClientLayoutAttribute.CommunicationDataType == CommunicationDataType.DataSet)
                    {
                        throw new MB.Util.APPException("树型浏览主界面暂时不支持DataSet 的绑定", MB.Util.APPMessageType.SysErrInfo);
                    }
                    else
                    {
                        IList lstDatas = null;
                        try {
                            lstDatas = _ClientRuleObject.GetObjects((int)_ClientRuleObject.MainDataTypeInDoc, queryParams);
                        }
                        catch (Exception ex) {
                            throw MB.Util.APPExceptionHandlerHelper.PromoteException(ex, "DefaultTreeListViewForm.GetObjects 出错!");
                        }

                        if (_BindingSource == null || _RecreateTreeAfterSorting)
                        {
                            IBindingList bl = _ClientRuleObject.CreateMainBindList(lstDatas);
                            _BindingSource              = new MB.WinBase.Binding.BindingSourceEx();
                            _BindingSource.ListChanged += new ListChangedEventHandler(_BindingSource_ListChanged);
                            _BindingSource.DataSource   = bl;
                            treeListHoster.CreateTreeListViewDataBinding(trvLstMain, _BindingSource);

                            if (trvLstMain.Nodes.Count > 0)
                            {
                                trvLstMain.Nodes[0].Expanded = true;
                                trvLstMain.FocusedNode       = trvLstMain.Nodes[0];
                            }
                            _RecreateTreeAfterSorting = false;
                        }
                        else
                        {
                            treeListHoster.RefreshTreeListData(trvLstMain, lstDatas);
                        }
                    }
                    panTitle.Visible = false;
                }
            }
            catch (MB.Util.APPException aex) {
                throw aex;
            }
            catch (Exception ex) {
                throw MB.Util.APPExceptionHandlerHelper.PromoteException(ex, "在浏览窗口DefaultTreeListViewForm_Load 时出错!");
            }
        }
        private void LoadDataObject()
        {
            ITreeListViewHoster treeListHoster = _TreeListHoster;
            IList lstDatas = null;

            try {
                int id = (int)_SortingNode.GetValue(_TreeListHoster.TreeViewCfg.KeyFieldName);
                MB.Util.Model.QueryParameterInfo[] queryParams = new Util.Model.QueryParameterInfo[1];
                queryParams[0] = new Util.Model.QueryParameterInfo(_TreeListHoster.TreeViewCfg.ParentFieldName, id, Util.DataFilterConditions.Equal);
                lstDatas       = _ClientRuleObject.GetObjects((int)_ClientRuleObject.MainDataTypeInDoc, queryParams);
            }
            catch (Exception ex) {
                throw MB.Util.APPExceptionHandlerHelper.PromoteException(ex, "DefaultTreeListViewForm.GetObjects 出错!");
            }

            if (_BindingSource == null)
            {
                IBindingList bl = _ClientRuleObject.CreateMainBindList(lstDatas);
                _BindingSource            = new MB.WinBase.Binding.BindingSourceEx();
                _BindingSource.DataSource = bl;
                treeListHoster.CreateTreeListViewDataBinding(trvLstMain, _BindingSource);

                if (trvLstMain.Nodes.Count > 0)
                {
                    trvLstMain.Nodes[0].Expanded = true;
                    trvLstMain.FocusedNode       = trvLstMain.Nodes[0];
                }
            }
            else
            {
                treeListHoster.RefreshTreeListData(trvLstMain, lstDatas);
            }
        }
        /// <summary>
        /// 设置控件数据源。
        /// </summary>
        /// <param name="clientRule"></param>
        /// <param name="dataSource"></param>
        public void SetDataSource(IClientRuleQueryBase clientRule, object dataSource)
        {
            IList lstDatas = dataSource as IList;

            if (lstDatas == null)
            {
                throw new MB.Util.APPException("目前树型浏览列表只支持IList 数据类型", MB.Util.APPMessageType.SysErrInfo);
            }

            _TreeListHoster = clientRule as ITreeListViewHoster;
            if (_TreeListHoster == null)
            {
                throw new MB.Util.APPException("获取树型列表数据的业务对象必须继承 ITreeListViewHoster 接口。", MB.Util.APPMessageType.SysErrInfo);
            }


            MB.WinBase.Binding.BindingSourceEx bindingSource = new MB.WinBase.Binding.BindingSourceEx();

            bindingSource.DataSource = dataSource;
            _TreeListHoster.CreateTreeListViewDataBinding(trvLstMain, bindingSource);
            trvLstMain.DataSource = lstDatas; //add by aifang 2012-04-17 数据绑定无效,重新对控件数据源赋值
            trvLstMain.RefreshDataSource();

            if (trvLstMain.Nodes.Count > 0)
            {
                trvLstMain.Nodes[0].Expanded = true;
                trvLstMain.FocusedNode       = trvLstMain.Nodes[0];
            }
        }
        private void TreeViewNodesSortingForm_Load(object sender, EventArgs e)
        {
            ITreeListViewHoster treeListHoster = _TreeListHoster;

            try {
                using (MB.WinBase.WaitCursor cursor = new MB.WinBase.WaitCursor(this)) {
                    LoadDataObject();
                }
            }
            catch (MB.Util.APPException aex) {
                throw aex;
            }
            catch (Exception ex) {
                throw MB.Util.APPExceptionHandlerHelper.PromoteException(ex, "在浏览窗口TreeViewNodesSortingForm_Load 时出错!");
            }
        }
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="parentSortingNode"></param>
        /// <param name="treeListHoster"></param>
        public TreeViewNodesSortingForm(DevExpress.XtraTreeList.Nodes.TreeListNode parentSortingNode,
                                        ITreeListViewHoster treeListHoster)
        {
            InitializeComponent();

            _SortingNode      = parentSortingNode;
            _TreeListHoster   = treeListHoster;
            _ClientRuleObject = treeListHoster as IClientRule;

            trvLstMain.OptionsBehavior.DragNodes = true;
            trvLstMain.OptionsView.ShowIndicator = false;
            _ImageList = MB.WinClientDefault.Images.ImageListHelper.Instance.GetDefaultTreeNodeImage();
            trvLstMain.StateImageList = _ImageList;
            trvLstMain.Dock           = DockStyle.Fill;
            _IsMainTreeNeedRefreshed  = false;

            if (_TreeListHoster == null || _TreeListHoster.TreeViewCfg == null ||
                string.IsNullOrEmpty(_TreeListHoster.TreeViewCfg.OrderFieldName))
            {
                throw new MB.Util.APPException("没有配置排序字段,不能打开排序窗口");
            }
        }
        void DefaultTreeListViewForm_Load(object sender, EventArgs e)
        {
            if (MB.Util.General.IsInDesignMode())
            {
                return;
            }

            if (_ClientRuleObject == null)
            {
                throw new MB.Util.APPException("请检查功能模块节点的业务类配置是否正确", MB.Util.APPMessageType.DisplayToUser);
            }
            //获取业务类默认设置的过滤条件参数
            _CurrentQueryParameters = _ClientRuleObject.GetDefaultFilterParams();
            _TreeListHoster         = _ClientRuleObject as ITreeListViewHoster;
            if (_TreeListHoster == null)
            {
                throw new MB.Util.APPException(string.Format("请检查{0} 是否已经实现了 ITreeListViewHoster接口", _ClientRuleObject.GetType().FullName), MB.Util.APPMessageType.SysErrInfo);
            }

            LoadObjectData(_CurrentQueryParameters);


            if (_ClientRuleObject != null)
            {
                string titleMsg = string.Empty;
                if (string.IsNullOrEmpty(_ClientRuleObject.DefaultFilterMessage))
                {
                    titleMsg = GetDefaultFilterMessage(_ClientRuleObject.ClientLayoutAttribute.DefaultFilter);
                }
                else
                {
                    titleMsg = _ClientRuleObject.DefaultFilterMessage;
                }

                panTitle.Visible = true;
                _ToolTip.SetToolTip(panTitle, titleMsg);
            }
        }
        void FrmGetObjectDataAssistant_Load(object sender, EventArgs e)
        {
            if (MB.Util.General.IsInDesignMode())
            {
                return;
            }

            if (_ClientRule == null)
            {
                string[] tps = this.InvokeDataSourceDesc.Type.Split(',');
                if (string.IsNullOrEmpty(this.InvokeDataSourceDesc.TypeConstructParams))
                {
                    _ClientRule = MB.Util.DllFactory.Instance.LoadObject(tps[0], tps[1]) as MB.WinBase.IFace.IClientRuleQueryBase;
                }
                else
                {
                    var conPars = this.InvokeDataSourceDesc.TypeConstructParams.Split(',');
                    _ClientRule = MB.Util.DllFactory.Instance.LoadObject(tps[0], conPars, tps[1]) as MB.WinBase.IFace.IClientRuleQueryBase;
                }
            }
            if (_ClientRule == null)
            {
                throw new MB.Util.APPException("没有得到客户端业务控制类!", MB.Util.APPMessageType.SysErrInfo);
            }

            //增加分页  add by aifang 2012-07-26 begin
            MB.WinBase.AppMessenger.DefaultMessenger.Subscribe <string>(QUERY_REFRESH_MSG_ID, o =>
            {
                labTitleMsg.Text = o;
            });
            if (_QueryObject == null && pnlQry.Visible)
            {
                lnkNextPage.Click     += new EventHandler(lnkNextPage_Click);
                lnkPreviousPage.Click += new EventHandler(lnkPreviousPage_Click);

                lnkPreviousPage.Enabled = false;
                lnkNextPage.Enabled     = false;
            }
            //增加分页  add by aifang 2012-07-26 end

            if (_StepShowControlPane == null)
            {
                _StepShowControlPane = new Dictionary <PaneViewType, Control>();
                _StepShowControlPane.Add(PaneViewType.FilterPane, CreateFilterControl(_ClientRule, ClumnEditCfgInfo.FilterCfgName));

                ITreeListViewHoster treeViewRule = _ClientRule as ITreeListViewHoster;
                if (treeViewRule == null)
                {
                    _ListView = new ucDataCheckListView();
                }
                else
                {
                    _ListView = new ucDataTreeListView();
                }

                _ListView.AfterSelectData += new GetObjectDataAssistantEventHandle(listView_AfterSelectData);
                _StepShowControlPane.Add(PaneViewType.DataSelect, _ListView as Control);

                foreach (Control ctl in _StepShowControlPane.Values)
                {
                    ctl.Dock = DockStyle.Fill;
                    panMain.Controls.Add(ctl);
                }
            }

            if (_HideFilterPane)
            {
                _StepShowControlPane[PaneViewType.DataSelect].BringToFront();
                _ListView.MultiSelect       = _MultiSelect;
                _ListView.ColumnEditCfgInfo = _ClumnEditCfgInfo;
                lnkChecked.Visible          = _MultiSelect;

                try
                {
                    //获得动态列的MessageKey
                    string messageHeaderKey = string.Empty;
                    if (_ClientRule.ClientLayoutAttribute.LoadType == ClientDataLoadType.ReLoad)
                    {
                        messageHeaderKey = _ClientRule.ClientLayoutAttribute.MessageHeaderKey;
                    }

                    //添加动态列消息头
                    MB.XWinLib.XtraGrid.XtraGridDynamicHelper.Instance.AppendQueryBehaviorColumns(_ClientRule);
                    //增加分页信息
                    if (_MAX_SHOW_ROWS <= 0)
                    {
                        _MAX_SHOW_ROWS = MB.Util.MyConvert.Instance.ToInt(nubMaxShotCount.Value);
                    }
                    _ClientRule.CurrentQueryBehavior.PageSize  = _MAX_SHOW_ROWS;
                    _ClientRule.CurrentQueryBehavior.PageIndex = 0;

                    using (QueryBehaviorScope scope = new QueryBehaviorScope(_ClientRule.CurrentQueryBehavior, messageHeaderKey))
                    {
                        List <MB.Util.Model.QueryParameterInfo> filterParas;
                        if (_FilterParametersIfNoFiterPanel != null)
                        {
                            filterParas = _FilterParametersIfNoFiterPanel;
                        }
                        else
                        {
                            filterParas = new List <MB.Util.Model.QueryParameterInfo>();
                        }

                        var lstDatas = this.GetFilterObjects(0, filterParas);
                        _ListView.SetDataSource(_ClientRule, lstDatas);

                        validateButton(PaneViewType.DataSelect);
                        butNext.Enabled      = false;
                        butPreviouss.Enabled = false;
                        validatedPageControl((lstDatas as IList).Count);
                    }
                }
                catch (Exception ex)
                {
                    MB.WinBase.ApplicationExceptionTerminate.DefaultInstance.ExceptionTerminate(ex);
                }
            }
            else
            {
                _StepShowControlPane[PaneViewType.FilterPane].BringToFront();
                validateButton(PaneViewType.FilterPane);
            }
            ucFilterCondition filterCtl = _StepShowControlPane[PaneViewType.FilterPane] as ucFilterCondition;

            if (filterCtl != null)
            {
                //panBottom.BackColor = filterCtl.AllowEmptyFilter ? System.Drawing.Color.FromArgb(212, 228, 248) : Color.White;
                if (filterCtl.AllowEmptyFilter)
                {
                    _ToolTip.SetToolTip(panBottom, "查询绿色通道,允许查询所有数据");
                }
            }
        }