bool ICustomizationService.ShowCustomizationMenu(object target) { if (_decorator == null) { return(false); } var barControl = target as BarControl; if (barControl != null && MayBe.Return(barControl.Bar, x => x.AllowCustomizationMenu, () => false)) { return(_decorator.CustomizationHelper.ShowToolbarsCustomizationMenu(barControl)); } var customizationButton = target as BarQuickCustomizationButton; if (customizationButton != null) { if (_decorator.CustomizationHelper.IsCustomizationMode) { return(false); } return(_decorator.CustomizationHelper.ShowCustomizationMenu(MayBe.With(LayoutHelper.FindParentObject <BarControl>(customizationButton), x => x.Bar), customizationButton)); } var linkControl = target as BarItemLinkControl; if (linkControl != null) { return(_decorator.CustomizationHelper.ShowItemCustomizationMenu(linkControl)); } return(false); }
void ICustomizationService.HideCustomizationMenu(object target) { if (_decorator == null) { return; } if (target == null) { _decorator.CustomizationHelper.HideCustomizationMenus(); } else { var barControl = target as BarControl; if (barControl != null && MayBe.Return(barControl.Bar, x => x.AllowCustomizationMenu, () => false)) { _decorator.CustomizationHelper.HideToolbarsCustomizationMenu(barControl); } else { var customizationButton = target as BarQuickCustomizationButton; if (customizationButton != null) { if (_decorator.CustomizationHelper.IsCustomizationMode) { _decorator.CustomizationHelper.HideCustomizationMenu(); } else { LayoutHelper.FindParentObject <BarControl>(customizationButton); _decorator.CustomizationHelper.HideCustomizationMenu(customizationButton); } } else { var barItemLinkControl = target as BarItemLinkControl; if (barItemLinkControl == null) { return; } _decorator.CustomizationHelper.HideItemCustomizationMenu(barItemLinkControl); } } } }