コード例 #1
0
 public ActionMenuItem(IModelMenuActionItem info, SingleChoiceAction menuItemsAction, string prefixId = "")
     : base(info, menuItemsAction, prefixId)
 {
     base.Enabled.SetItemValue("Action not null", this.Action != null);
     base.MenuItemsAction.Disposing += new EventHandler(this.MenuItemsAction_Disposing);
     base.Caption = base.RemoveAmpersand(info.Caption);
     base.ImageName = info.ImageName;
     base.ToolTip = info.ToolTip;
     if (this.Action != null)
     {
         base.Enabled.SetItemValue("Action is enabled", this.Action.Enabled);
         if (this.Action.Controller is ViewController)
         {
             base.Enabled.SetItemValue("Action is active", true);
         }
         else
         {
             base.Enabled.SetItemValue("Action is active", this.Action.Active);
         }
         base.Enabled.SetItemValue("HasRights", this.HasRights);
         this.Action.Changed += new EventHandler<ActionChangedEventArgs>(this.Action_Changed);
         SingleChoiceAction singleChoiceAction = this.Action as SingleChoiceAction;
         if (singleChoiceAction != null)
         {
             this.CreateItemsSingleChoiceAction(singleChoiceAction.Items, base.Items, base.Id);
             singleChoiceAction.ItemsChanged += new EventHandler<ItemsChangedEventArgs>(this.singleChoiceAction_ItemsChanged);
         }
     }
 }
コード例 #2
0
 public static ICollection<IModelAction> Get_MenuActions(IModelMenuActionItem modelExtender)
 {
     CalculatedModelNodeList<IModelAction> calculatedModelNodeList = new CalculatedModelNodeList<IModelAction>();
     calculatedModelNodeList.AddRange(
         from a in modelExtender.Application.ActionDesign.Actions.Where(delegate(IModelAction a)
         {
             IModelWindowController modelWindowController = a.Controller as IModelWindowController;
             IModelViewController modelViewController = a.Controller as IModelViewController;
             if (modelWindowController != null)
                 return modelWindowController.TargetWindowType == WindowType.Any || modelWindowController.TargetWindowType == WindowType.Main;
             if (modelViewController != null)
                 return true;
             return false;
         })
         orderby a.Id
         select a);
     return calculatedModelNodeList;
 }