コード例 #1
0
ファイル: ActionDef.cs プロジェクト: wlk0/OCTGN
 internal static BaseActionDef LoadFromXml(XElement xml)
 {
     if (xml.Name.LocalName.EndsWith("actions"))
     {
         return(ActionGroupDef.LoadFromXml(xml));
     }
     return(ActionDef.LoadFromXml(xml));
 }
コード例 #2
0
ファイル: GroupControl.cs プロジェクト: LordNat/OCTGN
        private MenuItem CreateCardMenuItem(BaseActionDef baseAction)
        {
            var item = new MenuItem {Header = baseAction.Name};

            var actionGroupDef = baseAction as ActionGroupDef;
            if (actionGroupDef != null)
            {
                foreach (MenuItem subItem in actionGroupDef.Children.Select(CreateCardMenuItem))
                    item.Items.Add(subItem);
                return item;
            }

            var action = baseAction as ActionDef;
            item.Tag = action;
            if (action != null)
            {
                item.InputGestureText = action.Shortcut;
                if (action.DefaultAction)
                {
                    item.FontWeight = FontWeights.Bold;
                    _defaultCardAction = action;
                }
            }
            item.Click += CardActionClicked;
            return item;
        }
コード例 #3
0
ファイル: GroupControl.cs プロジェクト: LordNat/OCTGN
        private void CreateContextMenus()
        {
            _cardHeader = null;
            _defaultGroupAction = _defaultCardAction = null;

            GroupDef def = group.Definition;

            // Create the card actions
            List<Control> cardItems = CreateCardMenuItems(def);
            _cardMenu.Collection = cardItems;

            // Create the group actions
            List<Control> groupItems = CreateGroupMenuItems(def);
            _groupMenu.Collection = groupItems;
        }
コード例 #4
0
ファイル: GroupControl.cs プロジェクト: YoshiEnVerde/OCTGN
    private MenuItem CreateCardMenuItem(BaseActionDef baseAction)
    {
      MenuItem item = new MenuItem() { Header = baseAction.Name };
      
      var group = baseAction as ActionGroupDef;
      if (group != null)
      {
        foreach (var subItem in group.Children.Select(x => CreateCardMenuItem(x)))
          item.Items.Add(subItem);
        return item;
      }

      var action = baseAction as ActionDef;
      item.Tag = action; 
      item.InputGestureText = action.Shortcut;
      if (action.DefaultAction)
      {
        item.FontWeight = FontWeights.Bold;
        defaultCardAction = action;
      }
      item.Click += CardActionClicked;
      return item;
    }
コード例 #5
0
ファイル: GroupControl.cs プロジェクト: YoshiEnVerde/OCTGN
    private void CreateContextMenus()
    {
      cardHeader = null;
      defaultGroupAction = defaultCardAction = null;

      var def = group.Definition;

      // Create the card actions
      var cardItems = CreateCardMenuItems(def);
      cardMenu.Collection = cardItems;

      // Create the group actions
      var groupItems = CreateGroupMenuItems(def);
      groupMenu.Collection = groupItems;
    }