private void FindMenuGroupPhanQuyen(RibbonPageGroupCollection items, string pScreenName, bool pEnable) { foreach (RibbonPageGroup menu in items) { if (string.Equals(pScreenName, menu.Tag)) { menu.Visible = pEnable; } } }
public static RibbonPageGroup Add(this RibbonPageGroupCollection collection, string text) { var group = new RibbonPageGroup(text) { ShowCaptionButton = false }; collection.Add(group); return(group); }
private void btnNapDL_Click(object sender, EventArgs e) { for (int k = 0; k < this._ribbon.Pages.Count; k++) { RibbonPageGroupCollection pgColection = this._ribbon.Pages[k].Groups; string prID = this._ribbon.Pages[k].Name; // pgColection[k].Name.ToString(); string prName = this._ribbon.Pages[k].Text; for (int j = 0; j < pgColection.Count; j++) { if (pgColection[j].Name.Contains("_ck")) { continue; //bỏ qua những group tên có dạng _ck } RibbonPageGroupItemLinkCollection colection = pgColection[j].ItemLinks; for (int i = 0; i < colection.Count; i++) { if (colection[i].Item.Name.Contains("_ck")) { continue; //bỏ qua những item tên có dạng _ck vì ko có trong bảng danh mục chức năng } ChucNangInfor objChucNang = new ChucNangInfor(); objChucNang.ParentId = prID; objChucNang.ParentName = prName; objChucNang.MaChucNang = colection[i].Item.Name; objChucNang.TenChucNang = colection[i].Item.Caption; ChucNangDataProvider.InsertIfNotExist(objChucNang); if (colection[i].Item is BarSubItem) { LinksInfo linksInfo = ((BarSubItem)colection[i].Item).LinksPersistInfo; for (int l = 0; l < linksInfo.Count; l++) { if (linksInfo[l].Item.Name.Contains("_ck")) { continue; } ChucNangInfor objSubChucNang = new ChucNangInfor(); objSubChucNang.ParentId = objChucNang.MaChucNang; objSubChucNang.ParentName = objChucNang.TenChucNang; objSubChucNang.MaChucNang = linksInfo[l].Item.Name; objSubChucNang.TenChucNang = linksInfo[l].Item.Caption; ChucNangDataProvider.InsertIfNotExist(objSubChucNang); } } } } } LoadAllChucNang(); MessageBox.Show("Nạp dữ liệu thành công!"); }
private void FindMenuPhanQuyen(RibbonPageGroupCollection mnuItems) { foreach (RibbonPageGroup menu in mnuItems) { if (menu.Tag.ToString().Equals("MHTQ")) { menu.Visible = true; } else { menu.Visible = k.kiemtrathucquyen(strNhan, menu.Tag.ToString()); } } }
/// <summary> /// Initializes a new instance of the <see cref="RibbonPageGroupCollectionUIAdapter"/> class. /// </summary> /// <param name="collection"></param> public RibbonPageGroupCollectionUIAdapter(RibbonPageGroupCollection collection) { Guard.ArgumentNotNull(collection, "RibbonPageGroupCollection"); ribbonPageGroupCollection = collection; }