示例#1
0
        public static string GetCurrentTrack()
        {
            if (!Spotify.IsAvailable())
            {
                return(string.Empty);
            }

            IntPtr        hWnd   = GetSpotify();
            int           length = Win32.GetWindowTextLength(hWnd);
            StringBuilder sb     = new StringBuilder(length + 1);

            Win32.GetWindowText(hWnd, sb, sb.Capacity);
            return(sb.ToString().Replace("Spotify", "").TrimStart(' ', '-').Trim());
        }
示例#2
0
        public static void SendAction(SpotifyAction a)
        {
            if (!Spotify.IsAvailable())
            {
                return;
            }

            switch (a)
            {
            case SpotifyAction.CopyTrackInfo:
            case SpotifyAction.ShowSpotify:
                ShowSpotify();
                break;

            default:
                Win32.SendMessage(GetSpotify(), Win32.Constants.WM_APPCOMMAND, IntPtr.Zero, new IntPtr((long)a));
                break;
            }
        }