/// /// (c) 2007 James A Briant /// /// Permission is granted to use or modify this source code provided that /// a) this notice is kept intact /// b) if you make any modications to this file you assign the /// copyright of those modifications to James Briant. /// c) you acknowledge that Mr. Briant offers no warranty /// and will not be liable for any loss, damages, time, etc. /// /// Any doubt, email me: firstname (nospace) lastname at persuasivesoftware.com using System; using System.ComponentModel.Design; using Microsoft.VisualStudio; namespace DevDriven.P4Vs.Common { internal enum HandlerKind { Exec = 0, Query = 1, } [AttributeUsage(AttributeTargets.Method, AllowMultiple = true)] internal class OleCommandHandlerAttribute : Attribute { private readonly HandlerKind kind; private readonly CommandID commandId; public OleCommandHandlerAttribute(int standardCmdId, HandlerKind kind) { commandId = new CommandID(VSConstants.GUID_VSStandardCommandSet97, standardCmdId); this.kind = kind; } public OleCommandHandlerAttribute(VSConstants.VSStd97CmdID standardCmdId, HandlerKind kind) : this((int)standardCmdId, kind) { } public OleCommandHandlerAttribute(int standardCmdId) : this(standardCmdId, HandlerKind.Exec) { } public OleCommandHandlerAttribute(VSConstants.VSStd97CmdID standardCmdId) : this((int)standardCmdId, HandlerKind.Exec) { } public OleCommandHandlerAttribute(string guidstring, uint cmd, HandlerKind kind) { commandId = new CommandID(new Guid(guidstring), (int) cmd); this.kind = kind; } public OleCommandHandlerAttribute(string guidstring, uint cmd) : this(guidstring, cmd, HandlerKind.Exec) { } public CommandID CommandID { get { return commandId; } } public HandlerKind Kind { get { return kind; } } } }