Exemplo n.º 1
0
        private void OpenMenu(tb_Sys_Menu menuInfo)
        {
            if (SelecedTabByName(menuInfo.MenuName))
            {
                return;
            }
            //var m = this.MdiChildren.Where(i => i.Text ==menuInfo.MenuName).FirstOrDefault();
            //if (m != null)
            //{
            //    //m.WindowState = FormWindowState.Maximized;
            //    m.Show();
            //    return;
            //}
            if (string.IsNullOrWhiteSpace(menuInfo.NameSpeace))
            {
                return;
            }
            if (menuInfo.MenuName == "权限管理")
            {
                A004_RoleControl frm = new A004_RoleControl();
                frm.MdiParent = this;
                frm.Text      = menuInfo.MenuName;
                frm.Show();
                return;
            }
            Type type = Type.GetType(menuInfo.NameSpeace);

            if (type == null)
            {
                throw new AppException("没有对应的窗体类型,创建失败");
            }
            ListForm     obj       = (ListForm)Activator.CreateInstance(type);
            tb_Sys_Roles rolesData = appCacheService.GetItem("roles") as tb_Sys_Roles;
            //Guid roleId = rolesDataXml.Element("Id").Value.ToGuid();
            var buttonList = buttonService.GetButtonsByMenu(menuInfo.Id, rolesData.Id);

            obj.Text = menuInfo.MenuName;
            obj.Tag  = menuInfo;
            obj.CreateToolBar(buttonList);
            obj.MdiParent = this;
            //obj.WindowState = FormWindowState.Maximized;
            obj.Show();
            //obj.ShowDig(this,menuInfo.MenuName);
        }