/// <summary> /// 创建数据网格浏览界面。 /// </summary> /// <param name="mdiForm"></param> /// <param name="nodeInfo"></param> public void ShowViewGridForm(MB.WinBase.IFace.IMdiMainForm mdiForm, MB.Util.Model.ModuleTreeNodeInfo nodeInfo) { ModuleOpenState openState = new ModuleOpenState(); openState.OpennedFrom = ModuleOpennedFrom.Menu; ShowViewGridForm(mdiForm, nodeInfo, openState); }
/// <summary> /// 创建数据网格浏览界面。 /// </summary> /// <param name="mdiForm"></param> /// <param name="nodeInfo"></param> /// <param name="opennedFrom"></param> public void ShowViewGridForm(MB.WinBase.IFace.IMdiMainForm mdiForm, MB.Util.Model.ModuleTreeNodeInfo nodeInfo, ModuleOpenState openState) { MB.Util.Model.ModuleCommandInfo commandInfo = nodeInfo.Commands.Find (o => (UICommandType)Enum.Parse(typeof(UICommandType), o.CommandID) == UICommandType.Open); if (commandInfo == null) { MB.WinBase.MessageBoxEx.Show(string.Format("模块{0} 的浏览窗口没有配置!", nodeInfo.Name)); return; } IForm viewGridForm = null; try { viewGridForm = CreateWinForm(null, commandInfo) as IForm; var uiStyle = viewGridForm.ActiveUIType; //viewGridForm.ModuleInfo = nodeInfo; if (viewGridForm.ClientRuleObject != null) { viewGridForm.ClientRuleObject.OpennedState = openState; viewGridForm.ClientRuleObject.ModuleTreeNodeInfo = nodeInfo; //验证当前活动窗口的列信息。 mdiForm.ValidatedColumns(viewGridForm); } Form frmMdiChild = viewGridForm as Form; frmMdiChild.Text = nodeInfo.Name; if (uiStyle == ClientUIType.ShowModelForm) { (viewGridForm as Form).ShowDialog(); } else { frmMdiChild.MdiParent = mdiForm as Form; frmMdiChild.Show(); } //else { // throw new MB.Util.APPException(string.Format("窗口配置的ShowModel类型 {0} 当前还没有进行处理", commandInfo.ViewModel.ToString()), MB.Util.APPMessageType.SysErrInfo); //} } catch (MB.Util.APPException aex) { if (viewGridForm != null) { (viewGridForm as Form).Dispose(); } throw aex; } catch (Exception ex) { if (viewGridForm != null) { (viewGridForm as Form).Dispose(); } //throw new MB.Util.APPException(" 根据ModuleTreeNodeInfo 的信息创建窗口时出错:", MB.Util.APPMessageType.SysErrInfo , ex); throw MB.Util.APPExceptionHandlerHelper.PromoteException(ex, " 根据ModuleTreeNodeInfo 的信息创建窗口时出错!"); } }