Search Results for

    Show / Hide Table of Contents

    Class CommandsAttribute

    An attribute to be used against the Commands 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
    System.Object
    System.Attribute
    CommandsAttribute
    Implements
    ICommandDescriptor
    Inherited Members
    System.Attribute.Equals(System.Object)
    System.Attribute.GetCustomAttribute(System.Reflection.Assembly, System.Type)
    System.Attribute.GetCustomAttribute(System.Reflection.Assembly, System.Type, System.Boolean)
    System.Attribute.GetCustomAttribute(System.Reflection.MemberInfo, System.Type)
    System.Attribute.GetCustomAttribute(System.Reflection.MemberInfo, System.Type, System.Boolean)
    System.Attribute.GetCustomAttribute(System.Reflection.Module, System.Type)
    System.Attribute.GetCustomAttribute(System.Reflection.Module, System.Type, System.Boolean)
    System.Attribute.GetCustomAttribute(System.Reflection.ParameterInfo, System.Type)
    System.Attribute.GetCustomAttribute(System.Reflection.ParameterInfo, System.Type, System.Boolean)
    System.Attribute.GetCustomAttributes(System.Reflection.Assembly)
    System.Attribute.GetCustomAttributes(System.Reflection.Assembly, System.Boolean)
    System.Attribute.GetCustomAttributes(System.Reflection.Assembly, System.Type)
    System.Attribute.GetCustomAttributes(System.Reflection.Assembly, System.Type, System.Boolean)
    System.Attribute.GetCustomAttributes(System.Reflection.MemberInfo)
    System.Attribute.GetCustomAttributes(System.Reflection.MemberInfo, System.Boolean)
    System.Attribute.GetCustomAttributes(System.Reflection.MemberInfo, System.Type)
    System.Attribute.GetCustomAttributes(System.Reflection.MemberInfo, System.Type, System.Boolean)
    System.Attribute.GetCustomAttributes(System.Reflection.Module)
    System.Attribute.GetCustomAttributes(System.Reflection.Module, System.Boolean)
    System.Attribute.GetCustomAttributes(System.Reflection.Module, System.Type)
    System.Attribute.GetCustomAttributes(System.Reflection.Module, System.Type, System.Boolean)
    System.Attribute.GetCustomAttributes(System.Reflection.ParameterInfo)
    System.Attribute.GetCustomAttributes(System.Reflection.ParameterInfo, System.Boolean)
    System.Attribute.GetCustomAttributes(System.Reflection.ParameterInfo, System.Type)
    System.Attribute.GetCustomAttributes(System.Reflection.ParameterInfo, System.Type, System.Boolean)
    System.Attribute.GetHashCode()
    System.Attribute.IsDefaultAttribute()
    System.Attribute.IsDefined(System.Reflection.Assembly, System.Type)
    System.Attribute.IsDefined(System.Reflection.Assembly, System.Type, System.Boolean)
    System.Attribute.IsDefined(System.Reflection.MemberInfo, System.Type)
    System.Attribute.IsDefined(System.Reflection.MemberInfo, System.Type, System.Boolean)
    System.Attribute.IsDefined(System.Reflection.Module, System.Type)
    System.Attribute.IsDefined(System.Reflection.Module, System.Type, System.Boolean)
    System.Attribute.IsDefined(System.Reflection.ParameterInfo, System.Type)
    System.Attribute.IsDefined(System.Reflection.ParameterInfo, System.Type, System.Boolean)
    System.Attribute.Match(System.Object)
    System.Attribute.TypeId
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetType()
    System.Object.MemberwiseClone()
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.ToString()
    Namespace: LemonEdge.Core.Client
    Assembly: API.dll
    Syntax
    [AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = false)]
    public class CommandsAttribute : 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.CommandsAttribute.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

    CommandsAttribute(String, ImageType, String, ImageType, String)

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

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

    The title of this command

    ImageType iconID

    The image used for this command

    System.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

    System.String tooltip

    A user friendly tool tip for this command functionality

    CommandsAttribute(String, ImageType, String, ImageType, String, String)

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

    Declaration
    public CommandsAttribute(string title, ImageType iconID, string description, ImageType overlayIconID, string tooltip, string helpURL)
    Parameters
    Type Name Description
    System.String title

    The title of this command

    ImageType iconID

    The image used for this command

    System.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

    System.String tooltip

    A user friendly tool tip for this command functionality

    System.String helpURL

    An optional url for help documentation around this commands function

    CommandsAttribute(String, String, String, ImageType, String)

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

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

    The title of this command

    System.String iconGuid

    The image used for this command

    System.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

    System.String tooltip

    A user friendly tool tip for this command functionality

    CommandsAttribute(String, String, String, ImageType, String, String)

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

    Declaration
    public CommandsAttribute(string title, string iconGuid, string description, ImageType overlayIconID, string tooltip, string helpURL)
    Parameters
    Type Name Description
    System.String title

    The title of this command

    System.String iconGuid

    The image used for this command

    System.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

    System.String tooltip

    A user friendly tool tip for this command functionality

    System.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
    System.String

    HelpURL

    An optional url for help documentation around this commands function

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

    IconID

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

    Declaration
    public Guid IconID { get; }
    Property Value
    Type Description
    System.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
    System.Nullable<System.Guid>

    Parameter

    Any parameter for this command, deriving from CommandSerializedParam

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

    Title

    The title of this command

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

    ToolTip

    A user friendly tool tip for this command functionality

    Declaration
    public string ToolTip { get; }
    Property Value
    Type Description
    System.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
    System.Guid

    Methods

    GetDescriptors(Commands)

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

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

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

    Returns
    Type Description
    System.Collections.Generic.IEnumerable<ICommandDescriptor>

    All ICommandDescriptors from this attribute marked against the specified Commands 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
    System.Type typeWithCommandFields

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

    System.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(Commands)

    Converts this attribute to its equivelant ICommandDescriptor with the specified type

    Declaration
    public ICommandDescriptor ToCommandDecriptor(Commands type)
    Parameters
    Type Name Description
    Commands 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
    System.Guid type

    The unique id of this command

    Returns
    Type Description
    ICommandDescriptor

    Its equivelant ICommandDescriptor with the specified type

    Implements

    ICommandDescriptor

    Extension Methods

    MiscExtensions.SetIfNotEqual<T, P>(T, Expression<Func<T, P>>, P)
    ReflectionExtensions.ClearEventInvocations(Object, String)
    StringExtensions.ToCSVFormatString(Object, Type)
    SQLExtensions.ToSQLValue(Object, Boolean)

    See Also

    ICommandDescriptor
    Commands
    In This Article
    Back to top © LemonTree Software Ltd. All rights reserved.