Task <bool> IniMenu() { return(Task.Run(() => { DataTable dt = T_Sysset.GetMenuSet(); if (dt == null || dt.Rows.Count <= 0) { return false; } for (int i = 0; i < dt.Rows.Count; i++) { string strname = dt.Rows[i][0].ToString(); if (strname.Trim().Length <= 0) { continue; } if (T_User.UserMenu.IndexOf(DESEncrypt.DesEncrypt(strname)) < 0) { continue; } SideBarPanelItem item = new SideBarPanelItem(); item.Name = strname; item.Text = strname; item.FontBold = true; sideBarManger.Invoke(new Action(() => { sideBarManger.Panels.Add(item); sideBarManger.Refresh(); })); } return true; })); }