Exemplo n.º 1
0
        private QuickMixPlaylistFactory(
            int mediaId,
            MediaType mediaType,
            EQuickMixMode mode,
            out HRESULT hr)
            : base(true)
        {
            TimeSpan maxBatchTimeout = TimeSpan.FromMilliseconds(5000.0);

            int[] seedMediaIds = new int[1] {
                mediaId
            };
            this._mode = mode;
            QuickMix instance = QuickMix.Instance;

            hr = instance.CreateSession(this._mode, seedMediaIds, (EMediaTypes)mediaType, out this._quickMixSession);
            if (!hr.IsSuccess)
            {
                return;
            }
            this._shouldDisposeSession = true;
            if (this._mode != EQuickMixMode.eQuickMixModeSimilarArtists)
            {
                PerfTrace.TraceUICollectionEvent(UICollectionEvent.QuickMixBegin, "");
            }
            hr = this._quickMixSession.GetSimilarMedia((uint)ClientConfiguration.QuickMix.DefaultPlaylistLength, maxBatchTimeout, new SimilarMediaBatchHandler(this.SimilarBatchHandler), new BatchEndHandler(this.BatchEndHandler));
        }
Exemplo n.º 2
0
 private void BatchEndHandler(HRESULT hrAsync) => Application.DeferredInvoke(delegate
 {
     this._hrCreation = hrAsync;
     this.Ready       = true;
     if (this._mode == EQuickMixMode.eQuickMixModeSimilarArtists)
     {
         return;
     }
     PerfTrace.TraceUICollectionEvent(UICollectionEvent.QuickMixComplete, "");
 }, null);