private void CreateRegularGroupItems()
        {
            var defaultMenuGroupId = _menuSettings.Settings.DefaultMenuGroupId;

            foreach (var group in _menuSettings.Settings.MainMenuGroupNames)
            {
                string groupId = group.Id.ToString();
                bool   isHome  = groupId.Equals(MenuSettings.MENU_ID_HOME, StringComparison.CurrentCultureIgnoreCase);
                if (isHome && _menuSettings.Settings.DisableHomeTab)
                {
                    continue;
                }

                string groupName = group.Name;
                var    groupItem = new GroupMenuListItem(Consts.KEY_NAME, groupName);
                if (_menuSettings.Settings.DisableAutoSelection)
                {
                    groupItem.Command = new MethodDelegateCommand(() => SetGroup(groupId));
                }

                groupItem.AdditionalProperties["Id"]   = groupId;
                groupItem.AdditionalProperties["Item"] = group;
                if (groupId == defaultMenuGroupId)
                {
                    IsHome             = isHome;
                    groupItem.IsActive = true;
                    groupItem.Selected = true;
                }
                _mainMenuGroupList.Add(groupItem);
            }
        }
Beispiel #2
0
        private void CreateShortcutItems(ICollection <ListItem> itemsList)
        {
            ItemsList menuItems = MenuItems;

            lock (menuItems.SyncRoot)
            {
                foreach (var menuItem in menuItems)
                {
                    object action;
                    if (!menuItem.AdditionalProperties.TryGetValue(Consts.KEY_ITEM_ACTION, out action))
                    {
                        continue;
                    }
                    WorkflowAction wfAction = action as WorkflowAction;
                    if (wfAction == null)
                    {
                        continue;
                    }

                    var shortCut = _menuSettings.Settings.MainMenuShortCuts.FirstOrDefault(sc => sc.ActionId == wfAction.ActionId);
                    if (shortCut == null)
                    {
                        continue;
                    }

                    string groupId   = shortCut.Id.ToString();
                    string groupName = shortCut.Name;
                    var    groupItem = new GroupMenuListItem(Consts.KEY_NAME, groupName);
                    if (_menuSettings.Settings.DisableAutoSelection)
                    {
                        groupItem.Command = new MethodDelegateCommand(() =>
                        {
                            ExecuteShortcutAction(groupId, wfAction);
                        });
                    }

                    groupItem.AdditionalProperties["Id"]       = groupId;
                    groupItem.AdditionalProperties["ActionId"] = wfAction.ActionId;
                    itemsList.Add(groupItem);
                }
            }
        }
    protected void CreateMenuGroupItems()
    {
      lock (_mainMenuGroupList.SyncRoot)
      {
        _mainMenuGroupList.Clear();
        if (_menuSettings != null)
        {
          foreach (var group in _menuSettings.Settings.MainMenuGroupNames)
          {
            string groupId = group.Id.ToString();
            bool isHome = groupId.Equals(MenuSettings.MENU_ID_HOME, StringComparison.CurrentCultureIgnoreCase);
            if (isHome && _menuSettings.Settings.DisableHomeTab)
              continue;

            string groupName = group.Name;
            var groupItem = new GroupMenuListItem(Consts.KEY_NAME, groupName);
            if (_menuSettings.Settings.DisableAutoSelection)
              groupItem.Command = new MethodDelegateCommand(() => SetGroup(groupId));

            groupItem.AdditionalProperties["Id"] = groupId;
            if (groupId == _menuSettings.Settings.DefaultMenuGroupId)
            {
              IsHome = isHome;
              groupItem.IsActive = true;
              groupItem.Selected = true;
            }
            _mainMenuGroupList.Add(groupItem);
          }
        }
      }
      _mainMenuGroupList.FireChange();
    }
Beispiel #4
0
    private void CreateShortcutItems()
    {
      foreach (var menuItem in MenuItems)
      {
        object action;
        if (!menuItem.AdditionalProperties.TryGetValue(Consts.KEY_ITEM_ACTION, out action))
          continue;
        WorkflowAction wfAction = action as WorkflowAction;
        if (wfAction == null)
          continue;

        var shortCut = _menuSettings.Settings.MainMenuShortCuts.FirstOrDefault(sc => sc.ActionId == wfAction.ActionId);
        if (shortCut == null)
          continue;

        string groupId = shortCut.Id.ToString();
        string groupName = shortCut.Name;
        var groupItem = new GroupMenuListItem(Consts.KEY_NAME, groupName);
        if (_menuSettings.Settings.DisableAutoSelection)
          groupItem.Command = new MethodDelegateCommand(() =>
          {
            wfAction.Execute();
            SetGroup(groupId, true);
          });

        groupItem.AdditionalProperties["Id"] = groupId;
        groupItem.AdditionalProperties["ActionId"] = wfAction.ActionId;
        _mainMenuGroupList.Add(groupItem);
      }
    }