示例#1
0
 public override void Apply(IActionBuildingContext builder)
 {
     foreach (var formerActionId in _formerActionIds)
     {
         builder.Action.FormerActionIDs.Add(formerActionId);
     }
 }
		/// <summary>
		/// Constructs/initializes an <see cref="DropDownButtonAction"/> via the given <see cref="IActionBuildingContext"/>.
		/// </summary>
		/// <remarks>For internal framework use only.</remarks>
		public override void Apply(IActionBuildingContext builder)
		{
			base.Apply(builder);

			((DropDownButtonAction)builder.Action).SetMenuModelDelegate(
				DropDownActionAttribute.CreateGetMenuModelDelegate(builder.ActionTarget, _menuModelPropertyName));
		}
示例#3
0
 public override void Apply(IActionBuildingContext builder)
 {
     if (!string.IsNullOrEmpty(FeatureToken))
     {
         builder.Action.FeatureSpecification = new FeatureAuthorizationSpecification(FeatureToken);
     }
 }
		public override void Apply(IActionBuildingContext builder)
		{
			if (!string.IsNullOrEmpty(FeatureToken))
			{
				builder.Action.FeatureSpecification = new FeatureAuthorizationSpecification(FeatureToken);
			}
		}
        /// <summary>
        /// Constructs/initializes an <see cref="DropDownButtonAction"/> via the given <see cref="IActionBuildingContext"/>.
        /// </summary>
        /// <remarks>For internal framework use only.</remarks>
        public override void Apply(IActionBuildingContext builder)
        {
            base.Apply(builder);

            ((DropDownButtonAction)builder.Action).SetMenuModelDelegate(
                DropDownActionAttribute.CreateGetMenuModelDelegate(builder.ActionTarget, _menuModelPropertyName));
        }
示例#6
0
			/// <summary>
			/// Sets the icon set for an <see cref="IAction"/>, via the specified <see cref="IActionBuildingContext"/>.
			/// </summary>
			public override void Apply(IActionBuildingContext builder)
			{
				//TODO (CR Mar 2010): Observe MouseButton changing and set the iconset.
				XMouseButtons assignedButton = XMouseButtons.None;
				if (builder.ActionTarget is MouseImageViewerTool)
					assignedButton = ((MouseImageViewerTool) builder.ActionTarget).MouseButton;
				builder.Action.IconSet = new MouseButtonIconSet(this.IconSet, assignedButton);
			}
    	/// <summary>
		/// Applies this attribute to an <see cref="IAction"/> instance, via the specified <see cref="IActionBuildingContext"/>,
		/// by binding the appropriate handler method on the target object to the action.
    	/// </summary>
    	public override void Apply(IActionBuildingContext builder)
        {
            // check that the method exists, etc
            ValidateClickHandler(builder.ActionTarget, this.HandlerMethodName);

            ClickHandlerDelegate clickHandler =
                (ClickHandlerDelegate)Delegate.CreateDelegate(typeof(ClickHandlerDelegate), builder.ActionTarget, this.HandlerMethodName);
            ((ClickAction)builder.Action).SetClickHandler(clickHandler);
        }
示例#8
0
		public override void Apply(IActionBuildingContext builder)
		{
			ActionPath path = new ActionPath(_pathHint, builder.ResourceResolver);
			builder.Action = new ActionPlaceholder(builder.ActionID, path, builder.ResourceResolver);
			builder.Action.Available = _initiallyAvailable;
			builder.Action.Persistent = true;
			builder.Action.Visible = false;
			builder.Action.Label = path.LastSegment.LocalizedText;
			builder.Action.GroupHint = new GroupHint(_groupHint ?? string.Empty);
		}
示例#9
0
        /// <summary>
        /// Binds an <see cref="IAction"/> instance to the <paramref name="actionProperty"/> and
        /// <paramref name="actionEvent"/> on the target object, via the specified <see cref="IActionBuildingContext"/>.
        /// </summary>
        protected void Bind <T>(IActionBuildingContext builder, string actionProperty, string actionEvent)
        {
            ValidateProperty(builder.ActionTarget, this.PropertyName, typeof(T));
            ValidateEvent(builder.ActionTarget, this.ChangeEventName);

            IObservablePropertyBinding <T> toolBinding   = new DynamicObservablePropertyBinding <T>(builder.ActionTarget, this.PropertyName, this.ChangeEventName);
            IObservablePropertyBinding <T> actionBinding = new DynamicObservablePropertyBinding <T>(builder.Action, actionProperty, actionEvent);

            ObservablePropertyCoupler <T> .Couple(toolBinding, actionBinding);
        }
示例#10
0
        /// <summary>
        /// Applies this attribute to an <see cref="IAction"/> instance, via the specified <see cref="IActionBuildingContext"/>,
        /// by binding the appropriate handler method on the target object to the action.
        /// </summary>
        public override void Apply(IActionBuildingContext builder)
        {
            // check that the method exists, etc
            ValidateClickHandler(builder.ActionTarget, this.HandlerMethodName);

            ClickHandlerDelegate clickHandler =
                (ClickHandlerDelegate)Delegate.CreateDelegate(typeof(ClickHandlerDelegate), builder.ActionTarget, this.HandlerMethodName);

            ((ClickAction)builder.Action).SetClickHandler(clickHandler);
        }
示例#11
0
		/// <summary>
		/// Constructs/initializes a <see cref="DropDownAction"/> via the given <see cref="IActionBuildingContext"/>.
		/// </summary>
		/// <remarks>For internal framework use only.</remarks>
		public override void Apply(IActionBuildingContext builder)
		{
			ActionPath path = new ActionPath(_path, builder.ResourceResolver);
			builder.Action = new DropDownAction(builder.ActionID, path, builder.ResourceResolver);
			builder.Action.Available = this.InitiallyAvailable;
			builder.Action.Persistent = true;
			builder.Action.Label = path.LastSegment.LocalizedText;

			((DropDownAction)builder.Action).SetMenuModelDelegate(
				CreateGetMenuModelDelegate(builder.ActionTarget, _menuModelPropertyName));
		}
示例#12
0
            /// <summary>
            /// Sets the icon set for an <see cref="IAction"/>, via the specified <see cref="IActionBuildingContext"/>.
            /// </summary>
            public override void Apply(IActionBuildingContext builder)
            {
                //TODO (CR Mar 2010): Observe MouseButton changing and set the iconset.
                XMouseButtons assignedButton = XMouseButtons.None;

                if (builder.ActionTarget is MouseImageViewerTool)
                {
                    assignedButton = ((MouseImageViewerTool)builder.ActionTarget).MouseButton;
                }
                builder.Action.IconSet = new MouseButtonIconSet(this.IconSet, assignedButton);
            }
        public override void Apply(IActionBuildingContext builder)
        {
            ActionPath path = new ActionPath(_pathHint, builder.ResourceResolver);

            builder.Action            = new ActionPlaceholder(builder.ActionID, path, builder.ResourceResolver);
            builder.Action.Available  = _initiallyAvailable;
            builder.Action.Persistent = true;
            builder.Action.Visible    = false;
            builder.Action.Label      = path.LastSegment.LocalizedText;
            builder.Action.GroupHint  = new GroupHint(_groupHint ?? string.Empty);
        }
示例#14
0
        /// <summary>
        /// Constructs/initializes a <see cref="DropDownAction"/> via the given <see cref="IActionBuildingContext"/>.
        /// </summary>
        /// <remarks>For internal framework use only.</remarks>
        public override void Apply(IActionBuildingContext builder)
        {
            ActionPath path = new ActionPath(_path, builder.ResourceResolver);

            builder.Action            = new DropDownAction(builder.ActionID, path, builder.ResourceResolver);
            builder.Action.Available  = this.InitiallyAvailable;
            builder.Action.Persistent = true;
            builder.Action.Label      = path.LastSegment.LocalizedText;

            ((DropDownAction)builder.Action).SetMenuModelDelegate(
                CreateGetMenuModelDelegate(builder.ActionTarget, _menuModelPropertyName));
        }
示例#15
0
        /// <summary>
        /// Binds an <see cref="IAction"/> instance to the <paramref name="actionProperty"/> and
        /// <paramref name="actionEvent"/> on the target object, via the specified <see cref="IActionBuildingContext"/>.
        /// </summary>
        protected void Bind <T>(IActionBuildingContext builder, string actionProperty, string actionEvent)
        {
            ValidateProperty(builder.ActionTarget, this.PropertyName, typeof(T));

            // the change event could be null, in which case there is nothing to validate
            if (!string.IsNullOrEmpty(this.ChangeEventName))
            {
                ValidateEvent(builder.ActionTarget, this.ChangeEventName);
            }

            IObservablePropertyBinding <T> toolBinding   = new DynamicObservablePropertyBinding <T>(builder.ActionTarget, this.PropertyName, this.ChangeEventName);
            IObservablePropertyBinding <T> actionBinding = new DynamicObservablePropertyBinding <T>(builder.Action, actionProperty, actionEvent);

            ObservablePropertyCoupler <T> .Couple(toolBinding, actionBinding);
        }
示例#16
0
		/// <summary>
		/// Applies permissions represented by this attribute to an action instance, via the specified <see cref="IActionBuildingContext"/>.
		/// </summary>
		public override void Apply(IActionBuildingContext builder)
        {
            // if this is the first occurence of this attribute, create the parent spec
            if (builder.Action.PermissionSpecification == null)
                builder.Action.PermissionSpecification = new OrSpecification();

            // combine the specified tokens with AND logic
            AndSpecification and = new AndSpecification();
            foreach (string token in _authorityTokens)
            {
                and.Add(new PrincipalPermissionSpecification(token));
            }

            // combine this spec with any previous occurence of this attribute using OR logic
            ((OrSpecification)builder.Action.PermissionSpecification).Add(and);
        }
示例#17
0
        /// <summary>
        /// Applies permissions represented by this attribute to an action instance, via the specified <see cref="IActionBuildingContext"/>.
        /// </summary>
        public override void Apply(IActionBuildingContext builder)
        {
            // if this is the first occurence of this attribute, create the parent spec
            if (builder.Action.PermissionSpecification == null)
            {
                builder.Action.PermissionSpecification = new OrSpecification();
            }

            // combine the specified tokens with AND logic
            AndSpecification and = new AndSpecification();

            foreach (string token in _authorityTokens)
            {
                and.Add(new PrincipalPermissionSpecification(token));
            }

            // combine this spec with any previous occurence of this attribute using OR logic
            ((OrSpecification)builder.Action.PermissionSpecification).Add(and);
        }
示例#18
0
        /// <summary>
        /// Applies this attribute to an <see cref="IAction"/> instance, via the specified <see cref="IActionBuildingContext"/>.
        /// </summary>
        /// <remarks>
        /// Because this action is an <see cref="ActionInitiatorAttribute"/>, this method actually
        /// creates the associated <see cref="ClickAction"/>.  <see cref="ActionDecoratorAttribute"/>s
        /// merely modify the properties of the action.
        /// </remarks>
        public override void Apply(IActionBuildingContext builder)
        {
            // assert _action == null
            ActionPath path = new ActionPath(this.Path, builder.ResourceResolver);

            builder.Action            = CreateAction(builder.ActionID, path, this.Flags, builder.ResourceResolver);
            builder.Action.Available  = this.InitiallyAvailable;
            builder.Action.Persistent = true;
            ((ClickAction)builder.Action).KeyStroke = this.KeyStroke;
            builder.Action.Label = path.LastSegment.LocalizedText;

            if (!string.IsNullOrEmpty(_clickHandler))
            {
                // check that the method exists, etc
                ValidateClickHandler(builder.ActionTarget, _clickHandler);

                ClickHandlerDelegate clickHandler =
                    (ClickHandlerDelegate)Delegate.CreateDelegate(typeof(ClickHandlerDelegate), builder.ActionTarget, _clickHandler);
                ((ClickAction)builder.Action).SetClickHandler(clickHandler);
            }
        }
 /// <summary>
 /// Binds the <see cref="IAction.Label"/> property and <see cref="IAction.LabelChanged"/> event
 /// to the corresponding items on the target object, via the specified <see cref="IActionBuildingContext"/>.
 /// </summary>
 public override void Apply(IActionBuildingContext builder)
 {
     Bind <string>(builder, "Label", "LabelChanged");
 }
示例#20
0
 public override void Apply(IActionBuildingContext builder)
 {
     foreach (var formerActionId in _formerActionIds)
         builder.Action.FormerActionIDs.Add(formerActionId);
 }
示例#21
0
 /// <summary>
 /// Sets the <see cref="IAction"/>'s <see cref="GroupHint"/>, via the specified <see cref="IActionBuildingContext"/>.
 /// </summary>
 public override void Apply(IActionBuildingContext builder)
 {
     builder.Action.GroupHint = new GroupHint(_groupHint);
 }
		/// <summary>
		/// Applies permissions represented by this attribute to an action instance, via the specified <see cref="IActionBuildingContext"/>.
		/// </summary>
		public override void Apply(IActionBuildingContext builder)
		{
			builder.Action.PermissionSpecification = new MockSpecification {Result = _result};
		}
示例#23
0
		/// <summary>
		/// Applies this attribute to an <see cref="IAction"/> instance, via the specified <see cref="IActionBuildingContext"/>.
		/// </summary>
		public abstract void Apply(IActionBuildingContext builder);
示例#24
0
 /// <summary>
 /// Sets the icon set for an <see cref="IAction"/>, via the specified <see cref="IActionBuildingContext"/>.
 /// </summary>
 public override void Apply(IActionBuildingContext builder)
 {
     builder.Action.IconSet = IconSet;
 }
		/// <summary>
		/// Binds the <see cref="IAction.IconSet"/> property and <see cref="IAction.IconSetChanged"/> event 
		/// to the corresponding items on the target object, via the specified <see cref="IActionBuildingContext"/>.
		/// </summary>
		public override void Apply(IActionBuildingContext builder)
		{
			Bind<IconSet>(builder, "IconSet", "IconSetChanged");
		}
示例#26
0
		/// <summary>
		/// Sets the icon set for an <see cref="IAction"/>, via the specified <see cref="IActionBuildingContext"/>.
		/// </summary>
		public override void Apply(IActionBuildingContext builder)
		{
			builder.Action.IconSet = IconSet;
		}
示例#27
0
 /// <summary>
 /// Binds the <see cref="IAction.IconSet"/> property and <see cref="IAction.IconSetChanged"/> event
 /// to the corresponding items on the target object, via the specified <see cref="IActionBuildingContext"/>.
 /// </summary>
 public override void Apply(IActionBuildingContext builder)
 {
     Bind <IconSet>(builder, "IconSet", "IconSetChanged");
 }
示例#28
0
 public override void Apply(IActionBuildingContext builder)
 {
     builder.Action.Persistent = _persistent;
 }
示例#29
0
 /// <summary>
 /// Applies permissions represented by this attribute to an action instance, via the specified <see cref="IActionBuildingContext"/>.
 /// </summary>
 public override void Apply(IActionBuildingContext builder)
 {
     builder.Action.PermissionSpecification = new MockSpecification {
         Result = _result
     };
 }
示例#30
0
		/// <summary>
		/// Binds the <see cref="IAction.Label"/> property and <see cref="IAction.LabelChanged"/> event 
		/// to the corresponding items on the target object, via the specified <see cref="IActionBuildingContext"/>.
		/// </summary>
        public override void Apply(IActionBuildingContext builder)
		{
            Bind<string>(builder, "Label", "LabelChanged");
        }
 /// <summary>
 /// Binds the <see cref="IAction.Tooltip"/> property and <see cref="IAction.TooltipChanged"/> event
 /// to the corresponding items on the target object, via the specified <see cref="IActionBuildingContext"/>.
 /// </summary>
 public override void Apply(IActionBuildingContext builder)
 {
     Bind <string>(builder, "Tooltip", "TooltipChanged");
 }
		/// <summary>
		/// Binds the <see cref="IClickAction.Checked"/> property and <see cref="IClickAction.CheckedChanged"/> event 
		/// to the corresponding items on the target object, via the specified <see cref="IActionBuildingContext"/>.
		/// </summary>
		public override void Apply(IActionBuildingContext builder)
        {
            Bind<bool>(builder, "Checked", "CheckedChanged");
        }
示例#33
0
 /// <summary>
 /// Sets the <see cref="IAction.Tooltip"/> value for and <see cref="IAction"/> instance,
 /// via the specified <see cref="IActionBuildingContext"/>.
 /// </summary>
 public override void Apply(IActionBuildingContext builder)
 {
     // assert _action != null
     builder.Action.Tooltip = builder.ResourceResolver.LocalizeString(this.TooltipText);
 }
示例#34
0
		/// <summary>
		/// Sets the <see cref="IAction"/>'s <see cref="GroupHint"/>, via the specified <see cref="IActionBuildingContext"/>.
		/// </summary>
        public override void Apply(IActionBuildingContext builder)
		{
			builder.Action.GroupHint = new GroupHint(_groupHint);
		}
		/// <summary>
		/// Binds the <see cref="IAction.Tooltip"/> property and <see cref="IAction.TooltipChanged"/> event 
		/// to the corresponding items on the target object, via the specified <see cref="IActionBuildingContext"/>.
		/// </summary>
		public override void Apply(IActionBuildingContext builder)
		{
            Bind<string>(builder, "Tooltip", "TooltipChanged");
        }
示例#36
0
		/// <summary>
		/// Sets the <see cref="IAction.Tooltip"/> value for and <see cref="IAction"/> instance,
		/// via the specified <see cref="IActionBuildingContext"/>.
		/// </summary>
        public override void Apply(IActionBuildingContext builder)
        {
            // assert _action != null
            builder.Action.Tooltip = builder.ResourceResolver.LocalizeString(this.TooltipText);
        }
 /// <summary>
 /// Binds the <see cref="IAction.Enabled"/> property and <see cref="IAction.EnabledChanged"/> event
 /// to the corresponding items on the target object, via the specified <see cref="IActionBuildingContext"/>.
 /// </summary>
 public override void Apply(IActionBuildingContext builder)
 {
     Bind <bool>(builder, "Enabled", "EnabledChanged");
 }
示例#38
0
 /// <summary>
 /// Applies this attribute to an <see cref="IAction"/> instance, via the specified <see cref="IActionBuildingContext"/>.
 /// </summary>
 public abstract void Apply(IActionBuildingContext builder);
		/// <summary>
		/// Binds the <see cref="IAction.Visible"/> property and <see cref="IAction.VisibleChanged"/> event 
		/// to the corresponding items on the target object, via the specified <see cref="IActionBuildingContext"/>.
		/// </summary>
        public override void Apply(IActionBuildingContext builder)
		{
            Bind<bool>(builder, "Visible", "VisibleChanged");
        }
		/// <summary>
		/// Applies this attribute to an <see cref="IAction"/> instance, via the specified <see cref="IActionBuildingContext"/>.
    	/// </summary>
    	/// <remarks>
    	/// Because this action is an <see cref="ActionInitiatorAttribute"/>, this method actually
    	/// creates the associated <see cref="ClickAction"/>.  <see cref="ActionDecoratorAttribute"/>s
    	/// merely modify the properties of the action.
    	/// </remarks>
    	public override void Apply(IActionBuildingContext builder)
        {
            // assert _action == null
            ActionPath path = new ActionPath(this.Path, builder.ResourceResolver);
            builder.Action = CreateAction(builder.ActionID, path, this.Flags, builder.ResourceResolver);
			builder.Action.Available = this.InitiallyAvailable;
            builder.Action.Persistent = true;
            ((ClickAction)builder.Action).KeyStroke = this.KeyStroke;
            builder.Action.Label = path.LastSegment.LocalizedText;

            if (!string.IsNullOrEmpty(_clickHandler))
            {
                // check that the method exists, etc
                ValidateClickHandler(builder.ActionTarget, _clickHandler);

                ClickHandlerDelegate clickHandler =
                    (ClickHandlerDelegate)Delegate.CreateDelegate(typeof(ClickHandlerDelegate), builder.ActionTarget, _clickHandler);
                ((ClickAction)builder.Action).SetClickHandler(clickHandler);
            }
        }