private void msyslogout_click(Object sender, EventArgs e) { sidebar.Visible = false; if (MessageBox.Show("是否确定退出!", "登出", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK && Pub.cfg.curr_userinfo != null) { if (this.MdiChildren.Length > 0) { MessageBox.Show("請先關閉所窗口!", "登出", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } Pub.cfg.curr_userinfo = null; for (int i = 0; i < Pub.cfg.listSubSys.Count; i++) { SystemPrivilegeMng instance = Pub.cfg.listSubSys[i]; instance.RemoveMenu(this.Menu); instance = null; } Pub.cfg.listSubSys.Clear(); Pub.cfg.listSubSys = null; Sidebar <Form1> .CleanSibebar(sidebar, listView1); } }
private void login_click(Object sender, EventArgs e) { if (Pub.cfg.curr_userinfo == null) { LoginUserPwd lup = new SAL.LoginUserPwd(); if (lup.ShowDialog() == DialogResult.OK) { MessageBox.Show(""); Pub.cfg.curr_userinfo.MainForm = this; string[] SubSysPrivilegeArr = Pub.cfg.curr_userinfo.SubSysPrivilege.Split(';'); List <SidebarItem> sidebarItems = new List <SidebarItem>(); for (int i = 0; i < Pub.cfg.curr_userinfo.SysPrivilege.Length; i++) { if (Pub.cfg.curr_userinfo.SysPrivilege[i] == '1') { SystemPrivilegeMng instance = null; if (i >= SubSysPrivilegeArr.Length) { instance = SystemPrivilegeMngDef.GetInstance(i, this, ""); } else { instance = SystemPrivilegeMngDef.GetInstance(i, this, SubSysPrivilegeArr[i]); } if (instance != null) { Pub.cfg.listSubSys.Add(instance); instance.AddMenu(this.Menu); if (instance.sidebaritem != null) { sidebarItems.Add(instance.sidebaritem); } } } } Sidebar <Form1> sidebar_binding = new Sidebar <Form1>(this, sidebar, listView1, imageList1, sidebarItems); } } }