示例#1
0
        void SetVisibility(BarButtonItem barItem)
        {
            ButtonBase wButtonBase = null;

            if (barItem.Tag.GetType() == typeof(ButtonBase))
            {
                wButtonBase         = ((ButtonBase)barItem.Tag);
                wButtonBase.Enabled = UC_UserControlBase.CheckRule(wButtonBase.AuthorizationRuleName);

                if (!wButtonBase.Enabled)
                {
                    barItem.Visibility = BarItemVisibility.Never;
                }
            }
        }
示例#2
0
        public void PerformAuthorization()
        {
            foreach (BarButtonItem barItem in barManager1.Items)
            {
                SetVisibility(barItem);

                if (barItem.Tag.GetType() == typeof(PopupButton))
                {
                    barItem.Visibility = BarItemVisibility.Never;

                    foreach (BarLargeButtonItemLink item in ((PopupMenu)barItem.DropDownControl).ItemLinks)
                    {
                        Boolean wResult = UC_UserControlBase.CheckRule(((ButtonBase)item.Item.Tag).AuthorizationRuleName);

                        if (wResult)
                        {
                            barItem.Visibility = BarItemVisibility.Always;
                            break;
                        }
                    }
                }
            }
        }