/// <summary> /// 双击grid中的信息,打开详细界面 /// </summary> protected virtual void ShowDetailForm() { //如果异步窗口的UIRule不是从AbstractClientRule继承而来的,则不能双击打开 if (!(this._AsynQueryRule is IClientRule)) { return; } MB.Util.Model.ModuleCommandInfo commandInfo = this._AsynQueryRule.ModuleTreeNodeInfo.Commands.Find (o => string.Compare(o.CommandID, MB.BaseFrame.SOD.MODULE_COMMAND_ADD, true) == 0); var cInfo = this._AsynQueryRule.ModuleTreeNodeInfo.Commands.Find (o => string.Compare(o.CommandID, MB.BaseFrame.SOD.MODULE_COMMAND_EDIT, true) == 0); //如果不存在就去新增加的默认配置 if (cInfo != null) { commandInfo = cInfo; } if (commandInfo == null) { MB.WinBase.MessageBoxEx.Show(string.Format("模块{0} 的编辑窗口没有配置!", this._AsynQueryRule.ModuleTreeNodeInfo.Name)); return; } IExtenderEditForm baseEditForm = null; IClientRule clientRule = _AsynQueryRule as IClientRule; if (clientRule == null) { throw new APPException("异步模块如果要打开详细信息,UI Rule必需继承自AbstractClientRule", APPMessageType.DisplayToUser); } try { MB.WinBase.IFace.IForm editForm = MB.WinClientDefault.UICommand.UICreateHelper.Instance.CreateObjectEditForm( commandInfo, ClientRuleObject as IClientRule, ObjectEditType.OpenReadOnly, _BindingSource); Form frm = editForm as Form; baseEditForm = editForm as IExtenderEditForm; if (baseEditForm != null) { baseEditForm.MainBindingGridView = new MB.WinClientDefault.Common.MainViewDataNavigator(gridViewMain); } frm.ShowDialog(); } catch (Exception ex) { throw ex; } finally { if (baseEditForm != null) { baseEditForm.DisposeBindingEvent(); } } }
//显示对象窗口 protected virtual void ShowObjectEditForm(ObjectEditType editType) { if (editType != ObjectEditType.AddNew && _BindingSource.Current == null) { return; } MB.Util.Model.ModuleCommandInfo commandInfo = this._ClientRuleObject.ModuleTreeNodeInfo.Commands.Find (o => string.Compare(o.CommandID, MB.BaseFrame.SOD.MODULE_COMMAND_ADD, true) == 0); if (editType == ObjectEditType.OpenEdit) { var cInfo = this._ClientRuleObject.ModuleTreeNodeInfo.Commands.Find (o => string.Compare(o.CommandID, MB.BaseFrame.SOD.MODULE_COMMAND_EDIT, true) == 0); //如果不存在就去新增加的默认配置 if (cInfo != null) { commandInfo = cInfo; } } if (commandInfo == null) { MB.WinBase.MessageBoxEx.Show(string.Format("模块{0} 的编辑窗口没有配置!", this._ClientRuleObject.ModuleTreeNodeInfo.Name)); return; } if (_BindingSource == null) { throw new MB.Util.APPException(" 目前框架只支持绑定到数据实体的集合,对于DataSet 目前不支持显示对象窗口的编辑。", MB.Util.APPMessageType.SysFileInfo); } // IExtenderEditForm baseEditForm = null; try { MB.WinBase.IFace.IForm editForm = MB.WinClientDefault.UICommand.UICreateHelper.Instance.CreateObjectEditForm( commandInfo, ClientRuleObject as IClientRule, editType, _BindingSource); if (editForm == null) { throw new MB.Util.APPException(" 以DefaultViewForm 做为浏览窗口的编辑窗口必须 实现 MB.WinBase.IFace.IForm "); } Form frm = editForm as Form; baseEditForm = editForm as IExtenderEditForm; if (baseEditForm != null) { baseEditForm.MainBindingGridView = this.GetViewDataNavigator(); } frm.ShowDialog(); //如果动态列,则关闭编辑页面以后自动刷新查询窗口 //if (_ClientRuleObject.ClientLayoutAttribute.LoadType == ClientDataLoadType.ReLoad) // Refresh(); } catch (Exception ex) { throw ex; } finally { if (baseEditForm != null) { baseEditForm.DisposeBindingEvent(); } } }