Beispiel #1
0
        private void TrackChangeTimerTick(object sender, System.Timers.ElapsedEventArgs e)
        {
            Console.WriteLine("Set Command4 back to original String.");
            timer.Stop();
            timer.Elapsed -= TrackChangeTimerTick;

            // set timer to null, and set string back to original spotify string.
            // done if user disabled animation otherwise execute animation if it is not disabled with define NO_ANIM
            if (!UserPreferences.Default.EnableInteractiveAnimation)
            {
                timer = null;
                if (Command1Package.SpotifyCommandShouldShowText())
                {
                    myOleCommand.Text = kSpotifyOpenString;
                }
                else
                {
                    myOleCommand.Text = " ";
                }
                return;
            }

#if NO_ANIM
            timer             = null;
            myOleCommand.Text = kSpotifyOpenString;
#else
            timer.Elapsed += TimerAnimateOriginal;
            timer.Interval = kANIMATE_SPOT_STRING;
            timer.Start();
#endif
        }
Beispiel #2
0
 private void TimerAnimateOriginal(object sender, System.Timers.ElapsedEventArgs e)
 {
     if (myOleCommand.Text.Length <= kSpotifyOpenString.Length)
     {
         timer.Stop();
         timer.Elapsed -= TimerAnimateOriginal;
         timer          = null;
         if (Command1Package.SpotifyCommandShouldShowText())
         {
             myOleCommand.Text = kSpotifyOpenString;
         }
         else
         {
             myOleCommand.Text = " ";
         }
     }
     else
     {
         if (myOleCommand.Text.Length > kSpotifyOpenString.Length)
         {
             myOleCommand.Text = myOleCommand.Text.Remove(myOleCommand.Text.Length - 1);
         }
         else
         {
             myOleCommand.Text += " ";
         }
     }
 }
Beispiel #3
0
        public void UpdateTextHiddenState()
        {
            if (!Command1Package.SpotifyCommandShouldShowText() && !UserPreferences.Default.HideButtonTextOnInactive)
            {
                return;
            }

            if (!Command1Package.IsSpotifyProcessRunning())
            {
                buttonMenuCommand.Text = " ";
            }
            else
            {
                buttonMenuCommand.Text = commandText;
            }
        }
Beispiel #4
0
 public void SetStartupCommandTextState()
 {
     if (!Command1Package.SpotifyCommandShouldShowText())
     {
         myOleCommand.Text = " ";
     }
     else
     {
         if (IsSpotifyProcessRunning())
         {
             myOleCommand.Text = kSpotifyOpenString;
         }
         else
         {
             myOleCommand.Text = kSpotifyStartString;
         }
     }
 }
Beispiel #5
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;
            }
        }