2

Windows Phone 7 で音楽プレーヤー アプリを作成しようとしています。Music+Videos アプリの履歴ページに項目を追加しても問題ありません。しかし、「Now Playing」タイルを関連付けて、クリックしたときに (または音量音楽コントロールを介して) アプリを開くようにしようとすると、例外がスローされます。

作業コード (履歴のみ):

if (currentsong != null)
        {
            MediaHistoryItem historyItem = new MediaHistoryItem();
            historyItem.Title = currentsong.Name;
            historyItem.Source = "";
            historyItem.ImageStream = currentsong.Album.GetAlbumArt();

            if (historyItem.ImageStream == null)
            {
                StreamResourceInfo sri = Application.GetResourceStream(new Uri("noalbum2.png", UriKind.Relative));
                historyItem.ImageStream = sri.Stream;
            }

            MediaHistory mediaHistory = MediaHistory.Instance;
            mediaHistory.WriteRecentPlay(historyItem); //WORKS
            mediaHistory.NowPlaying = historyItem;   //Throws exception
        }

生成される例外は次のとおりです。

タイプ 'System.InvalidOperationException' の未処理の例外が Microsoft.Phone.dll で発生しました

追加情報: 部分読み取り?

助けてください。

ありがとう、シッダント

4

0 に答える 0