Esempio n. 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PickColorCommand"/> class.
        /// Adds our command handlers for menu (commands must exist in the command table file)
        /// </summary>
        /// <param name="package">Owner package, not null.</param>
        private PickColorCommand(SolutionColorPackage package)
        {
            this.package = package;
            if (package == null)
            {
                throw new ArgumentNullException("package");
            }

            OleMenuCommandService commandService = ((IServiceProvider)package).GetService(typeof(IMenuCommandService)) as OleMenuCommandService;

            if (commandService != null)
            {
                var menuCommandID = new CommandID(SolutionColorPackage.ToolbarCommandSetGuid, CommandId);
                var menuItem      = new MenuCommand(this.Execute, menuCommandID);
                commandService.AddCommand(menuItem);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="EnableAutoPickColorCommand"/> class.
        /// Adds our command handlers for menu (commands must exist in the command table file)
        /// </summary>
        /// <param name="package">Owner package, not null.</param>
        private EnableAutoPickColorCommand(SolutionColorPackage package)
        {
            ThreadHelper.ThrowIfNotOnUIThread();

            this.package = package;
            if (package == null)
            {
                throw new ArgumentNullException("package");
            }

            OleMenuCommandService commandService = ((IServiceProvider)package).GetService(typeof(IMenuCommandService)) as OleMenuCommandService;

            if (commandService != null)
            {
                var menuCommandID = new CommandID(SolutionColorPackage.ToolbarCommandSetGuid, CommandId);
                menuItem = new MenuCommand(this.Execute, menuCommandID);
                commandService.AddCommand(menuItem);

                menuItem.Checked = package.Settings.IsAutomaticColorPickEnabled();
            }
        }
Esempio n. 3
0
 /// <summary>
 /// Initializes the singleton instance of the command.
 /// </summary>
 /// <param name="package">Owner package, not null.</param>
 public static void Initialize(SolutionColorPackage package)
 {
     Instance = new PickColorCommand(package);
 }
 public SolutionOpenListener(SolutionColorPackage package) : base(package)
 {
     this.package = package;
 }