예제 #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CommandPreviousTrack"/> 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 CommandPreviousTrack(Package package)
        {
            if (package == null)
            {
                throw new ArgumentNullException("package");
            }

            this.package = package;
            SpotifyRemote spotifyRemotePackage = package as SpotifyRemote;

            m_spotifyManager = spotifyRemotePackage.GetSpotifyManager();

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

            if (commandService != null)
            {
                var menuCommandID = new CommandID(CommandSet, CommandId);
                menuItem = new OleMenuCommand(this.MenuItemCallback, menuCommandID);
                commandService.AddCommand(menuItem);
            }

            SettingsManager setManager = SettingsManager.GetSettingsManager();

            setManager.SetTbButtonPrevious(ref menuItem);
        }
예제 #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CommandOpenSpotify"/> 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 CommandOpenSpotify(Package package)
        {
            if (package == null)
            {
                throw new ArgumentNullException("package");
            }
            SpotifyRemote spotifyRemotePackage = package as SpotifyRemote;

            m_spotifyManager = spotifyRemotePackage.GetSpotifyManager();


            this.package = package;

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

            if (commandService != null)
            {
                var menuCommandID = new CommandID(CommandSet, CommandId);
                menuItem = new OleMenuCommand(this.MenuItemCallback, menuCommandID);
                commandService.AddCommand(menuItem);
            }



            // Initialize TrackChangeAnimator.
            m_trackChangeAnimator = new TrackChangeAnimator();
            m_trackChangeAnimator.Initialize(menuItem, m_currentTextlabel);

            m_spotifyManager.SpotifyClientTrackChange += SpotifyClientTrackChange;


            SettingsManager setManager = SettingsManager.GetSettingsManager();

            setManager.SetTbButtonOpen(ref menuItem);
            setManager.SetTrackChangeAnimation(ref m_trackChangeAnimator);
        }