Beispiel #1
0
        /// <summary>
        /// 构造函数。
        /// </summary>
        /// <param name="titleName">视图标题。</param>
        /// <param name="userEntity">表示用户信息的对象。</param>
        public UserManageViewContent(string titleName, User userEntity)
            : base()
        {
            if (titleName != "")
            {
                this.TitleName = StringParser.Parse("${res:FanHai.Hemera.Addins.RBAC.UserManagementViewContent.TitleName}") + "-" + titleName;
            }
            else
            {
                this.TitleName = StringParser.Parse("${res:FanHai.Hemera.Addins.RBAC.UserManagementViewContent.TitleName}");
            }
            //define panel
            Panel panel = new Panel();

            //set panel dock style
            panel.Dock = DockStyle.Fill;
            //set panel BorderStyle
            panel.BorderStyle = BorderStyle.FixedSingle;

            userCtrl = new UserManagementCtrl(userEntity);
            //userCtrl.CtrlState = ControlState.New;
            userCtrl.Dock = DockStyle.Fill;
            //add control to panle
            panel.Controls.Add(userCtrl);
            //set panel to view content
            this.control = panel;
        }
Beispiel #2
0
        /// <summary>
        /// 点击新增按钮重新遍历页面标签并重新加载一个用户管理页面
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void tsbAddUser_Click(object sender, EventArgs e)
        {
            //对界面标签进行遍历查找查找到需要打开标前存在则激活该标签否则重新添加一个标签
            foreach (IViewContent viewContent in WorkbenchSingleton.Workbench.ViewContentCollection)
            {
                if (viewContent.TitleName == StringParser.Parse("${res:FanHai.Hemera.Addins.RBAC.UserManagementViewContent.TitleName}"))
                {
                    viewContent.WorkbenchWindow.SelectWindow();
                    UserManagementCtrl ctrl = (UserManagementCtrl)viewContent.Control.Controls.Find("UserManagementCtrl", true)[0];
                    ctrl.CtrlState = ControlState.New;
                    return;
                }
            }
            UserManageViewContent userManageViewContent = new UserManageViewContent("", new User()); //创建一个新的视图页面

            WorkbenchSingleton.Workbench.ShowView(userManageViewContent);                            //视图页面
        }