예제 #1
0
        private void MenuItemCommandAction(object parameter)
        {
            BurgerMenuItem item = parameter as BurgerMenuItem;

            if (item != null)
            {
                App.AppLogger.Logger.Log(devoctomy.DFramework.Logging.Interfaces.LoggerMessageType.VerboseHigh | devoctomy.DFramework.Logging.Interfaces.LoggerMessageType.Information, "Burger menu item clicked '{0}'.", item.Key);

                //determine what type this type is before performing any actions
                if (item.GetType() == typeof(BurgerMenuViewItem))
                {
                    App.Controller.NavigateTo(item.Key);
                }
                else if (item.GetType() == typeof(BurgerMenuPopupViewItem))
                {
                    App.Controller.ShowPopup(item.Key);
                }
                else if (item.GetType() == typeof(BurgerMenuCommandItem))
                {
                    BurgerMenuCommandItem commandItem      = item as BurgerMenuCommandItem;
                    BurgerMenuViewItem    selectedViewItem = SelectedItem as BurgerMenuViewItem;
                    View viewInstance = selectedViewItem.PageViewInstance;
                    commandItem.Invoke(viewInstance.BindingContext, new object[] { null });
                }
                IsMenuExpanded = false;
            }
        }
예제 #2
0
        private void AttachMenuItem(BurgerMenuItem menuItem)
        {
            App.AppLogger.Logger.Log(devoctomy.DFramework.Logging.Interfaces.LoggerMessageType.VerboseHigh | devoctomy.DFramework.Logging.Interfaces.LoggerMessageType.Information, "Attaching burger menu item '{0}'.", menuItem.Key);

            _menuItemsByKey.Add(menuItem.Key, menuItem);
            menuItem.AttachCommand(this, MenuItemCommand);
            foreach (BurgerMenuItem curChildItem in menuItem.ChildItems)
            {
                AttachMenuItem(curChildItem);
            }
        }
예제 #3
0
 public void SetChildCommandItemEnabledState(
     string parentKey,
     string childKey,
     bool enabled)
 {
     if (_menuItemsByKey.ContainsKey(parentKey))
     {
         BurgerMenuItem parent = _menuItemsByKey[parentKey];
         IEnumerable <BurgerMenuItem> matches = parent.ChildItems.Where(bmi => bmi.Key == childKey);
         if (matches.Any())
         {
             BurgerMenuItem first = matches.First();
             if (first is BurgerMenuCommandItem)
             {
                 first.IsEnabled = enabled;
             }
         }
     }
 }