Exemple #1
0
        public PlaylistResult CreateAndAddToUniquePlaylist(
            string title,
            Guid?serviceMediaId,
            IList items)
        {
            int     playlistId;
            HRESULT playlist1 = this._playlistManagerInterop.CreatePlaylist(title, null, serviceMediaId, CreatePlaylistOption.RenameOnConflict, out playlistId);

            if (playlist1.IsError)
            {
                return(new PlaylistResult(playlistId, playlist1));
            }
            PlaylistError playlist2 = this.AddToPlaylist(playlistId, items);

            return(new PlaylistResult(playlistId, playlist2));
        }
 internal PlaylistResult(int playlistId, HRESULT hr)
 {
     this._hr = hr;
     if (hr.IsSuccess && playlistId > 0)
     {
         this._playlistId = playlistId;
     }
     else
     {
         this._playlistId = PlaylistManager.InvalidPlaylistId;
         if (hr.Int == HRESULT._DB_E_RESOURCEEXISTS)
         {
             this._error = PlaylistError.NameExists;
         }
         else if (hr.Int == HRESULT._DB_E_BADPARAMETERNAME)
         {
             this._error = PlaylistError.InvalidName;
         }
         else
         {
             this._error = PlaylistError.Other;
         }
     }
 }
 public PlaylistResult(int playlistId, PlaylistError error)
 {
     this._playlistId = playlistId;
     this._error      = error;
 }