Esempio n. 1
0
/*******foobar2000*******/
        /// <summary>
        /// なうぷれを取得
        /// </summary>
        private async Task GenerateNowPlaying()
        {
            if (Process.GetProcessesByName("foobar2000").Length == 0)
            {
                TweetText.Text   = "";
                StatusLabel.Text = "Failed to detect foobar2000";
                return;
            }

            if (player.PlayerState != PlayerState.Playing)
            {
                TweetText.Text   = "";
                StatusLabel.Text = "foobar2000 is not playing song";
                return;
            }

            MediaItem media;

            try
            {
                media = await player.GetCurrentMedia();
            }
            catch (Exception)
            {
                TweetText.Text   = "";
                StatusLabel.Text = "Failed to get information from foobar2000";
                return;
            }

            GenerateNowPlayingCore(media);
        }