示例#1
0
 /// <summary>
 /// Initialization of the package; this method is called right after the package is sited, so this is the place
 /// where you can put all the initialization code that rely on services provided by VisualStudio.
 /// </summary>
 protected override void Initialize()
 {
     Command1.Initialize(this);
     base.Initialize();
     Command2.Initialize(this);
     Command3.Initialize(this);
     Command4.Initialize(this);
 }
示例#2
0
        /// <summary>
        /// Initialization of the package; this method is called right after the package is sited, so this is the place
        /// where you can put all the initialization code that rely on services provided by VisualStudio.
        /// </summary>
        protected override void Initialize()
        {
            base.Initialize();

            SettingsWindowCommand.Initialize(this);
            OpenSettingsCommand.Initialize(this);
            Command1.Initialize(this);
            Command2.Initialize(this);
            Command3.Initialize(this);
            Command4.Initialize(this);



            m_packageDTEEvents = ApplicationObject.Events.DTEEvents;
            m_packageDTEEvents.OnBeginShutdown   += new _dispDTEEvents_OnBeginShutdownEventHandler(HandleVisualStudioShutDown);
            m_packageDTEEvents.OnStartupComplete += M_packageDTEEvents_OnStartupComplete;
            SpotifyRemotePlayListWindowCommand.Initialize(this);
            Command5.Initialize(this);
        }
示例#3
0
 /// <summary>
 /// Initializes the singleton instance of the command.
 /// </summary>
 /// <param name="package">Owner package, not null.</param>
 public static void Initialize(Package package)
 {
     Instance = new Command4(package);
 }
示例#4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Command4"/> 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 Command4(Package package)
        {
            if (package == null)
            {
                throw new ArgumentNullException("package");
            }

            this.package = package;

            OleMenuCommandService commandService = this.ServiceProvider.GetService(typeof(IMenuCommandService)) as OleMenuCommandService;

            if (commandService != null)
            {
                var menuCommandID = new CommandID(CommandSet, CommandId);

                // var menuItem = new MenuCommand(this.MenuItemCallback, menuCommandID);

                myOleCommand = new OleMenuCommand(this.MenuItemCallback, menuCommandID);

                //if (null != myOleCommand)
                //{
                //    myOleCommand.Text = "New Text";
                //
                //}
                if (IsSpotifyProcessRunning())
                {
                    if (Command1Package.SpotifyCommandShouldShowText())
                    {
                        myOleCommand.Text = kSpotifyOpenString;
                    }
                    else
                    {
                        myOleCommand.Text = " ";
                    }
                }
                else
                {
                    if (UserPreferences.Default.HideButtonTextOnInactive)
                    {
                        myOleCommand.Text = " ";
                    }
                    else
                    {
                        myOleCommand.Text = kSpotifyStartString;
                    }
                }

                Microsoft.VisualStudio.Shell.ServiceProvider serviceProvider = new Microsoft.VisualStudio.Shell.ServiceProvider(((EnvDTE.DTE)Microsoft.VisualStudio.Shell.ServiceProvider.GlobalProvider.GetService(typeof(EnvDTE.DTE))) as Microsoft.VisualStudio.OLE.Interop.IServiceProvider);
                IVsUIShell uiShell = serviceProvider.GetService(typeof(SVsUIShell)) as IVsUIShell;
                uiShell.UpdateCommandUI(0);

                if (IsSpotifyProcessRunning())
                {
                    SpotClientRegisterTrackChange();
                }

                commandService.AddCommand(myOleCommand);

                gCommand4Instance = this;
            }
        }