public BarItem MapFrom(BarManager barManager, IMenuBarButton menuBarItem)
        {
            if (menuBarItem.IsForDeveloper && !_startOptions.IsDeveloperMode)
            {
                return new BarButtonItem {
                           Visibility = BarItemVisibility.Never
                }
            }
            ;

            var existingItem = barManager.Items[menuBarItem.Name];

            if (existingItem != null)
            {
                return(existingItem);
            }

            var menuBarCheckItem = menuBarItem as IMenuBarCheckItem;

            if (menuBarCheckItem != null)
            {
                return(_mapper.MapFrom(barManager, menuBarCheckItem));
            }

            var buttonItem = new BarButtonItem(barManager, menuBarItem.Caption);

            UpdateBarButtonItem(menuBarItem, buttonItem);

            return(buttonItem);
        }
    }
        public static IMenuBarButton WithUpdateCommandFor <TBuildingBlock>(this IMenuBarButton menuBarItem, Simulation simulation, TBuildingBlock templateBuildingBlock, UsedBuildingBlock usedBuildingBlock)
            where TBuildingBlock : class, IPKSimBuildingBlock
        {
            var command = IoC.Resolve <UpdateBuildingBlockInSimulationUICommand <TBuildingBlock> >();

            command.TemplateBuildingBlock = templateBuildingBlock;
            command.Simulation            = simulation;
            command.UsedBuildingBlock     = usedBuildingBlock;
            return(menuBarItem.WithCommand(command));
        }
        protected void UpdateBarButtonItem(IMenuBarButton menuBarItem, BarItem buttonItem)
        {
            base.UpdateBarButtonItem(menuBarItem, buttonItem);
            buttonItem.ItemClick += (o, e) =>
            {
                if (menuBarItem.Locked)
                {
                    return;
                }

                menuBarItem.Click();
            };
        }
Beispiel #4
0
        private void addSkinToGallery(RibbonGalleryBarItem rgbiSkins, IMenuBarButton menuBarItem)
        {
            SimpleButton imageButton = new SimpleButton();

            imageButton.LookAndFeel.SetSkinStyle(menuBarItem.Caption);
            GalleryItem gItem = new GalleryItem();

            gItem.Tag     = menuBarItem;
            gItem.Caption = menuBarItem.Caption;
            rgbiSkins.Gallery.Groups[0].Items.Add(gItem);

            gItem.Image      = getSkinImage(imageButton, 32, 17, 2);
            gItem.HoverImage = getSkinImage(imageButton, 70, 36, 5);
            gItem.Caption    = menuBarItem.Caption;
            gItem.Hint       = menuBarItem.Caption;
        }
Beispiel #5
0
 public static IMenuBarButton AsDisabledIf(this IMenuBarButton menuBarItem, bool disableCondition)
 {
     menuBarItem.Enabled = !disableCondition;
     return(menuBarItem);
 }
Beispiel #6
0
 public static IMenuBarButton WithEnabled(this IMenuBarButton menuBarItem, bool enabled)
 {
     menuBarItem.Enabled = enabled;
     return(menuBarItem);
 }
Beispiel #7
0
 public static IMenuBarButton WithCommandFor <TCommand, TObject>(this IMenuBarButton menuBarItem, TObject entity)
     where TCommand : IObjectUICommand <TObject>
     where TObject : class
 {
     return(menuBarItem.WithCommand(IoC.Resolve <TCommand>().For(entity)));
 }
Beispiel #8
0
 public static IMenuBarButton WithCommand <TCommand>(this IMenuBarButton menuBarItem) where TCommand : IUICommand
 {
     return(menuBarItem.WithCommand(IoC.Resolve <TCommand>()));
 }
Beispiel #9
0
 public static IMenuBarButton WithRemoveCommand <TParent, TChild>(this IMenuBarButton menuBarItem, TParent parent, TChild child)
     where TParent : class
     where TChild : class
 {
     return(menuBarItem.WithCommand(IoC.Resolve <RemoveCommandFor <TParent, TChild> >().For(parent, child)));
 }