Exemplo n.º 1
0
            public DasMenuItem getEsc(DasMenuItem RootItem, string currentSelection)
            {
                DasMenuItemRepository ItemRepository = new DasMenuItemRepository();
                DasMenuItem           CurrentItem    = ItemRepository.getItemOrDefault(ItemRepository.findOneByUid(RootItem, currentSelection), RootItem);

                if (CurrentItem.hasParent())
                {
                    CurrentItem = CurrentItem.getParent();
                }

                return(CurrentItem);
            }
Exemplo n.º 2
0
            public DasMenuItem getCycle(DasMenuItem RootItem, string currentSelection, int steps)
            {
                DasMenuItemRepository ItemRepository = new DasMenuItemRepository();
                DasMenuItem           CurrentItem    = ItemRepository.getItemOrDefault(ItemRepository.findOneByUid(RootItem, currentSelection), RootItem);

                if (CurrentItem.hasParent())
                {
                    int maxIndex     = CurrentItem.getParent().getChilds().Count - 1;
                    int currentIndex = ItemRepository.getIndex(CurrentItem);
                    int newIndex     = currentIndex + steps;
                    if (newIndex < 0)
                    {
                        newIndex = maxIndex;
                    }
                    if (newIndex > maxIndex)
                    {
                        newIndex = 0;
                    }
                    CurrentItem = CurrentItem.getParent().getChilds()[newIndex];
                }

                return(CurrentItem);
            }
Exemplo n.º 3
0
            public DasMenuItem getReturn(DasMenuItem RootItem, string currentSelection)
            {
                DasMenuItemRepository ItemRepository = new DasMenuItemRepository();
                DasMenuItem           CurrentItem    = ItemRepository.getItemOrDefault(ItemRepository.findOneByUid(RootItem, currentSelection), RootItem);

                if (CurrentItem.hasChilds())
                {
                    CurrentItem = CurrentItem.getChilds()[0];
                }
                else if (CurrentItem is DasMenuActionItem)
                {
                    ApplyAction(CurrentItem as DasMenuActionItem);
                }

                return(CurrentItem);
            }