Search Results for

    Show / Hide Table of Contents

    Class CommandAttribute

    An attribute to be used against the Command enum to provide context to their functionality, or custom fields to provide easy referenceable commands

    Also a concrete implementation of ICommandDescriptor to easily get the definition of system commands

    Inheritance
    object
    Attribute
    CommandAttribute
    Implements
    ICommandDescriptor
    Inherited Members
    Attribute.GetCustomAttributes(MemberInfo, Type)
    Attribute.GetCustomAttributes(MemberInfo, Type, bool)
    Attribute.GetCustomAttributes(MemberInfo)
    Attribute.GetCustomAttributes(MemberInfo, bool)
    Attribute.IsDefined(MemberInfo, Type)
    Attribute.IsDefined(MemberInfo, Type, bool)
    Attribute.GetCustomAttribute(MemberInfo, Type)
    Attribute.GetCustomAttribute(MemberInfo, Type, bool)
    Attribute.GetCustomAttributes(ParameterInfo)
    Attribute.GetCustomAttributes(ParameterInfo, Type)
    Attribute.GetCustomAttributes(ParameterInfo, Type, bool)
    Attribute.GetCustomAttributes(ParameterInfo, bool)
    Attribute.IsDefined(ParameterInfo, Type)
    Attribute.IsDefined(ParameterInfo, Type, bool)
    Attribute.GetCustomAttribute(ParameterInfo, Type)
    Attribute.GetCustomAttribute(ParameterInfo, Type, bool)
    Attribute.GetCustomAttributes(Module, Type)
    Attribute.GetCustomAttributes(Module)
    Attribute.GetCustomAttributes(Module, bool)
    Attribute.GetCustomAttributes(Module, Type, bool)
    Attribute.IsDefined(Module, Type)
    Attribute.IsDefined(Module, Type, bool)
    Attribute.GetCustomAttribute(Module, Type)
    Attribute.GetCustomAttribute(Module, Type, bool)
    Attribute.GetCustomAttributes(Assembly, Type)
    Attribute.GetCustomAttributes(Assembly, Type, bool)
    Attribute.GetCustomAttributes(Assembly)
    Attribute.GetCustomAttributes(Assembly, bool)
    Attribute.IsDefined(Assembly, Type)
    Attribute.IsDefined(Assembly, Type, bool)
    Attribute.GetCustomAttribute(Assembly, Type)
    Attribute.GetCustomAttribute(Assembly, Type, bool)
    Attribute.Equals(object)
    Attribute.GetHashCode()
    Attribute.Match(object)
    Attribute.IsDefaultAttribute()
    Attribute.TypeId
    object.GetType()
    object.MemberwiseClone()
    object.ToString()
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    Namespace: LemonEdge.API.Client
    Assembly: LemonEdge.API.dll
    Syntax
    [AttributeUsage(AttributeTargets.Field)]
    public class CommandAttribute : Attribute, ICommandDescriptor
    Remarks

    To use for a custom commands, you can do the following:

    public static class MyCommandsInfo
    {
    
        [Commands("Custom 1", ImageType.LemonEdge, "Explore all custom things.", ImageType.None, "Explore all custom things.")]
        public const string MyCustom1CommandIDString = "3DFAE1FE-6D9C-437E-A5D4-915BBF77E245";
        public static Guid MyCustom1CommandID =$gt; Guid.Parse(MyCustom1CommandIDString);
    
    }
    
    public class CommandDefinitions
    {
    
        public ICommandDescriptor GetCustomCommand1Info()
        {
            var buttonInfo = LemonEdge.Core.Client.CommandAttribute.GetDescriptors(typeof(MyCommandsInfo), MyCommandsInfo.MyCustom1CommandID);
            return buttonInfo;
        }
    }

    This provides a quick method for getting an ICommandDescriptor for your commands that can be shared between ui specific, and core code. This descriptor can be used in menu upgrades to easily provide default button implementations on the main menu for your custom commands. See IDefaultMenuInserter

    Constructors

    CommandAttribute(string, ImageType, string, ImageType, string)

    Creates a new ICommandDescriptor attribute against the marked field using the specified parameters

    Declaration
    public CommandAttribute(string title, ImageType iconID, string description, ImageType overlayIconID = ImageType.None, string tooltip = "")
    Parameters
    Type Name Description
    string title

    The title of this command

    ImageType iconID

    The image used for this command

    string description

    A user friendly description of this command

    ImageType overlayIconID

    On some clients another image can be overlayed on the bottom right of the main icon (for indicating add, remove, etc). This is the optional overlay image id

    string tooltip

    A user friendly tool tip for this command functionality

    CommandAttribute(string, ImageType, string, ImageType, string, string)

    Creates a new ICommandDescriptor attribute against the marked field using the specified parameters

    Declaration
    public CommandAttribute(string title, ImageType iconID, string description, ImageType overlayIconID, string tooltip, string helpURL)
    Parameters
    Type Name Description
    string title

    The title of this command

    ImageType iconID

    The image used for this command

    string description

    A user friendly description of this command

    ImageType overlayIconID

    On some clients another image can be overlayed on the bottom right of the main icon (for indicating add, remove, etc). This is the optional overlay image id

    string tooltip

    A user friendly tool tip for this command functionality

    string helpURL

    An optional url for help documentation around this commands function

    CommandAttribute(string, string, string, ImageType, string)

    Creates a new ICommandDescriptor attribute against the marked field using the specified parameters

    Declaration
    public CommandAttribute(string title, string iconGuid, string description, ImageType overlayIconID = ImageType.None, string tooltip = "")
    Parameters
    Type Name Description
    string title

    The title of this command

    string iconGuid

    The image used for this command

    string description

    A user friendly description of this command

    ImageType overlayIconID

    On some clients another image can be overlayed on the bottom right of the main icon (for indicating add, remove, etc). This is the optional overlay image id

    string tooltip

    A user friendly tool tip for this command functionality

    CommandAttribute(string, string, string, ImageType, string, string)

    Creates a new ICommandDescriptor attribute against the marked field using the specified parameters

    Declaration
    public CommandAttribute(string title, string iconGuid, string description, ImageType overlayIconID, string tooltip, string helpURL)
    Parameters
    Type Name Description
    string title

    The title of this command

    string iconGuid

    The image used for this command

    string description

    A user friendly description of this command

    ImageType overlayIconID

    On some clients another image can be overlayed on the bottom right of the main icon (for indicating add, remove, etc). This is the optional overlay image id

    string tooltip

    A user friendly tool tip for this command functionality

    string helpURL

    An optional url for help documentation around this commands function

    Properties

    Description

    A user friendly description of this command

    Declaration
    public string Description { get; }
    Property Value
    Type Description
    string

    HelpURL

    An optional url for help documentation around this commands function

    Declaration
    public string HelpURL { get; }
    Property Value
    Type Description
    string

    IconID

    The image to use for this command, either a ImageType or ImageID

    Declaration
    public Guid IconID { get; }
    Property Value
    Type Description
    Guid

    OverlayIconID

    On some clients another image can be overlayed on the bottom right of the main icon (for indicating add, remove, etc)

    This optional overlay image can be specified here, either a ImageType or ImageID

    Declaration
    public Guid? OverlayIconID { get; }
    Property Value
    Type Description
    Guid?

    Parameter

    Any parameter for this command, deriving from CommandSerializedParam

    Declaration
    public string Parameter { get; }
    Property Value
    Type Description
    string

    Title

    The title of this command

    Declaration
    public string Title { get; set; }
    Property Value
    Type Description
    string

    ToolTip

    A user friendly tool tip for this command functionality

    Declaration
    public string ToolTip { get; }
    Property Value
    Type Description
    string

    Type

    A globally unique id to identify this command in uniquel in the main menu. Comes from Type if it came from the standard set, but can be any id for custom commands, or Guid.Empty otherwise

    Declaration
    public Guid Type { get; }
    Property Value
    Type Description
    Guid

    Methods

    GetDescriptors(Command)

    Returns all ICommandDescriptors from this attribute marked against the specified Command enum value

    Declaration
    public static IEnumerable<ICommandDescriptor> GetDescriptors(Command type)
    Parameters
    Type Name Description
    Command type

    The enum value to return all attributes (transformed to ICOmmandDescriptors) against this value

    Returns
    Type Description
    IEnumerable<ICommandDescriptor>

    All ICommandDescriptors from this attribute marked against the specified Command enum value

    GetDescriptors(Type, Guid)

    Returns the attribute against the field in the specified type that holds the value matching the specified forCommandID. That attribute is then translated to its ICommandDescriptor equivelant

    Declaration
    public static ICommandDescriptor GetDescriptors(Type typeWithCommandFields, Guid forCommandID)
    Parameters
    Type Name Description
    Type typeWithCommandFields

    The type holding a set of Guid fields with CommandAttribute against them

    Guid forCommandID

    The value of a field against the specified type to look for

    Returns
    Type Description
    ICommandDescriptor

    The attribute against the field in the specified type that holds the value matching the specified forCommandID. That attribute is then translated to its ICommandDescriptor equivelant

    ToCommandDecriptor(Command)

    Converts this attribute to its equivelant ICommandDescriptor with the specified type

    Declaration
    public ICommandDescriptor ToCommandDecriptor(Command type)
    Parameters
    Type Name Description
    Command type

    The unique id of this command

    Returns
    Type Description
    ICommandDescriptor

    Its equivelant ICommandDescriptor with the specified type

    ToCommandDecriptor(Guid)

    Converts this attribute to its equivelant ICommandDescriptor with the specified type

    Declaration
    public ICommandDescriptor ToCommandDecriptor(Guid type)
    Parameters
    Type Name Description
    Guid type

    The unique id of this command

    Returns
    Type Description
    ICommandDescriptor

    Its equivelant ICommandDescriptor with the specified type

    Implements

    ICommandDescriptor

    Extension Methods

    LinqExtensions.AsArray<T>(T)
    LinqExtensions.ToArrayOfOne<T>(T)
    LinqExtensions.ToListOfOne<T>(T)
    MiscExtensions.SetIfNotEqual<T, TP>(T, Expression<Func<T, TP>>, TP)
    WeakReferenceExtensions.WeakReference(object)
    SQLExtensions.ToSQLValue(object, bool)
    ReflectionExtensions.ClearEventInvocations(object, string)
    StringExtensions.ToCSVFormatString(object, Type)

    See Also

    ICommandDescriptor
    Command
    In this article
    Back to top © LemonEdge Technologies. All rights reserved.