Beispiel #1
0
        public static int FindPin(int id, EMediaTypes type, int userId, int maxAge)
        {
            int nPinId;

            PinManager.Instance.FindPin(EPinType.ePinTypeGeneric, id, type, userId, maxAge, out nPinId);
            return(nPinId);
        }
Beispiel #2
0
        public virtual void GetMediaIdAndType(out int mediaId, out EMediaTypes mediaType)
        {
            object property = this.GetProperty("LibraryId");

            mediaId   = property == null ? -1 : (int)property;
            mediaType = NameToMediaType(this.TypeName);
        }
Beispiel #3
0
        public static int AddPin(
            EPinType pinType,
            int pinOrdinal,
            int id,
            EMediaTypes mediaType,
            int userId)
        {
            int pinId;

            PinManager.Instance.AddPin(pinType, id, mediaType, userId, pinOrdinal, out pinId);
            SingletonModelItem <JumpListManager> .Instance.JumpListPinUpdateRequested.Invoke();

            return(pinId);
        }
 private void OnFileAdded(IntPtr pszPath, EMediaTypes MediaType) => this.NotifyFileAddedStatus();
Beispiel #5
0
 public static int AddPin(int id, EMediaTypes mediaType, int userId) => AddPin(EPinType.ePinTypeGeneric, -1, id, mediaType, userId);
 public void GetMediaIdAndType(out int mediaId, out EMediaTypes mediaType)
 {
     mediaId   = this._id;
     mediaType = this._type;
 }
 public MediaIdAndType(int mediaId, EMediaTypes type)
 {
     this._id   = mediaId;
     this._type = type;
 }
        private void AddQuickMixItemsWorker(IList items)
        {
            QuickMix    instance   = QuickMix.Instance;
            HRESULT     hresult    = HRESULT._S_OK;
            EMediaTypes eMediaType = EMediaTypes.eMediaTypeInvalid;

            this._quickMixNoResultsStringId = StringId.IDS_QUICKMIX_ITEM_CREATION_UNAVAILABLE_TEXT;
            if (this._quickMixSession != null)
            {
                this._quickMixSession.Dispose();
                this._quickMixSession = null;
            }
            NotificationArea.Instance.RemoveAll(NotificationTask.QuickMix, NotificationState.OneShot);
            if (items[0] is Artist artist)
            {
                this._quickMixNoResultsStringId = StringId.IDS_QUICKMIX_ARTIST_CREATION_UNAVAILABLE_TEXT;
                hresult = instance.CreateSession(EQuickMixMode.eQuickMixModeNowPlaying, artist.Id, EMediaTypes.eMediaTypePersonArtist, artist.Title, out this._quickMixSession);
                if (hresult.IsSuccess)
                {
                    string text = string.Format(Shell.LoadString(StringId.IDS_QUICKMIX_NOTIFICATION_CREATION_BUSY_ONE_PARAM_TEXT), artist.Title);
                    this._quickMixCreatingNotification = new QuickMixNotification(Shell.LoadString(StringId.IDS_QUICKMIX_NOTIFICATION_CREATION_BUSY_TITLE), text, NotificationState.OneShot, false, 15000);
                    SQMLog.Log(SQMDataId.QuickMixRadioPlays, 1);
                }
            }
            if (hresult.IsSuccess && items[0] is LibraryDataProviderItemBase providerItemBase)
            {
                if (providerItemBase.TypeName == "Artist")
                {
                    eMediaType = EMediaTypes.eMediaTypePersonArtist;
                    this._quickMixNoResultsStringId = StringId.IDS_QUICKMIX_ARTIST_CREATION_UNAVAILABLE_TEXT;
                    string property = (string)providerItemBase.GetProperty("Title");
                    string text     = string.Format(Shell.LoadString(StringId.IDS_QUICKMIX_NOTIFICATION_CREATION_BUSY_ONE_PARAM_TEXT), property);
                    this._quickMixCreatingNotification = new QuickMixNotification(Shell.LoadString(StringId.IDS_QUICKMIX_NOTIFICATION_CREATION_BUSY_TITLE), text, NotificationState.OneShot, false, 15000);
                }
                else if (providerItemBase.TypeName == "Album")
                {
                    eMediaType = EMediaTypes.eMediaTypeAudioAlbum;
                    this._quickMixNoResultsStringId = StringId.IDS_QUICKMIX_ALBUM_CREATION_UNAVAILABLE_TEXT;
                    string property1 = (string)providerItemBase.GetProperty("ArtistName");
                    string property2 = (string)providerItemBase.GetProperty("Title");
                    string text      = string.Format(Shell.LoadString(StringId.IDS_QUICKMIX_NOTIFICATION_CREATION_BUSY_TWO_PARAM_TEXT), property1, property2);
                    this._quickMixCreatingNotification = new QuickMixNotification(Shell.LoadString(StringId.IDS_QUICKMIX_NOTIFICATION_CREATION_BUSY_TITLE), text, NotificationState.OneShot, false, 15000);
                }
                else if (providerItemBase.TypeName == "Track")
                {
                    eMediaType = EMediaTypes.eMediaTypeAudio;
                    this._quickMixNoResultsStringId = StringId.IDS_QUICKMIX_SONG_CREATION_UNAVAILABLE_TEXT;
                    string property1 = (string)providerItemBase.GetProperty("ArtistName");
                    string property2 = (string)providerItemBase.GetProperty("Title");
                    string text      = string.Format(Shell.LoadString(StringId.IDS_QUICKMIX_NOTIFICATION_CREATION_BUSY_TWO_PARAM_TEXT), property1, property2);
                    this._quickMixCreatingNotification = new QuickMixNotification(Shell.LoadString(StringId.IDS_QUICKMIX_NOTIFICATION_CREATION_BUSY_TITLE), text, NotificationState.OneShot, false, 15000);
                }
                int[] seedMediaIds = new int[1]
                {
                    (int)providerItemBase.GetProperty("LibraryId")
                };
                hresult = instance.CreateSession(EQuickMixMode.eQuickMixModeNowPlaying, seedMediaIds, eMediaType, out this._quickMixSession);
                SQMLog.Log(SQMDataId.QuickMixLocalPlays, 1);
            }
            if (hresult.IsSuccess)
            {
                if (this._quickMixSession != null)
                {
                    hresult            = this._quickMixSession.GetSimilarMedia((uint)ClientConfiguration.QuickMix.DefaultPlaylistLength, TimeSpan.FromMilliseconds(15000.0), new SimilarMediaBatchHandler(this.SimilarBatchHandler), new BatchEndHandler(this.BatchEndHandler));
                    this._quickMixType = this._quickMixSession.GetQuickMixType();
                    this._quickMixSession.GetPlaylistTitle(out this._quickMixTitle);
                }
                else
                {
                    hresult = HRESULT._E_UNEXPECTED;
                }
            }
            if (hresult.IsSuccess)
            {
                NotificationArea.Instance.Add(_quickMixCreatingNotification);
            }
            else
            {
                if (this._quickMixSession != null)
                {
                    this._quickMixSession.Dispose();
                    this._quickMixSession = null;
                }
                if (hresult.Int == HRESULT._ZUNE_E_QUICKMIX_MEDIA_NOT_FOUND)
                {
                    MessageBox.Show(Shell.LoadString(StringId.IDS_QUICKMIX_CREATION_UNAVAILABLE_NO_RESULTS_TITLE), Shell.LoadString(this._quickMixNoResultsStringId), null);
                }
                else
                {
                    ErrorDialogInfo.Show(hresult.Int, Shell.LoadString(StringId.IDS_QUICKMIX_CREATION_UNAVAILABLE_NO_RESULTS_TITLE));
                }
            }
        }