public static void CheckValidRegionAndLanguage() { if (FeatureEnablement.HasValidRegionAndLanguage()) { return; } ErrorDialogInfo.Show(HRESULT._ZUNE_E_UNKNOWN_REGION_OR_LANGUAGE.Int, Shell.LoadString(StringId.IDS_UNKNOWN_REGION_OR_LANGUAGE_TITLE)); }
private void BatchEndHandler(HRESULT hrAsync) => Application.DeferredInvoke(delegate { NotificationArea.Instance.Remove(_quickMixCreatingNotification); this._quickMixCreatingNotification = null; if (this._quickMixSession == null || !hrAsync.IsError) { return; } if (hrAsync.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(hrAsync.Int, Shell.LoadString(StringId.IDS_QUICKMIX_CREATION_UNAVAILABLE_NO_RESULTS_TITLE)); } }, null);
private void OnConfirm(object sender, EventArgs args) { SubscriptionManager instance = SubscriptionManager.Instance; int subscriptionMediaId = -1; if (!instance.FindByUrl(this.m_feedUrl, EMediaTypes.eMediaTypePodcastSeries, out subscriptionMediaId, out bool _)) { HRESULT hresult = instance.Subscribe(this.m_feedUrl, this.m_feedTitle, Guid.Empty, false, EMediaTypes.eMediaTypePodcastSeries, ESubscriptionSource.eSubscriptionSourceProtocolHandler, out subscriptionMediaId); if (hresult.IsSuccess) { string endPointUri = Service.GetEndPointUri(EServiceEndpointId.SEID_RootCatalog); if (!string.IsNullOrEmpty(endPointUri) && !string.IsNullOrEmpty(this.m_feedUrl) && this.m_feedUrl.Length < 1024) { WebRequestHelper.ConstructWebPostRequest(endPointUri + "/podcast", "URL=" + this.m_feedUrl, EPassportPolicyId.None, HttpRequestCachePolicy.Default, true, false).GetResponseAsync(new AsyncRequestComplete(this.OnRequestComplete), null); } } else { ErrorDialogInfo.Show(hresult.Int, Shell.LoadString(StringId.IDS_PODCAST_SUBSCRIPTION_ERROR)); } } PodcastLibraryPage.FindInCollection(subscriptionMediaId); }
private void OnCommitCompleteDeferred(object args) { HRESULT hresult = (HRESULT)((object[])args)[0]; if (!(((object[])args)[1] is MetadataEditProperty metadataEditProperty)) { return; } if (hresult.IsSuccess) { metadataEditProperty.OriginalValue = metadataEditProperty.Value; } else { if (metadataEditProperty.Descriptor is ProfilePropertyDescriptor) { string title = Shell.LoadString(((ProfilePropertyDescriptor)metadataEditProperty.Descriptor).DisplayNameId); ErrorDialogInfo.Show(hresult.Int, title); } metadataEditProperty.Value = metadataEditProperty.OriginalValue; } metadataEditProperty.Modified = false; }
public static void ErrorMessageMoreCartItemsAvailable(int extraCartItems) { StringId stringId = extraCartItems == 1 ? StringId.IDS_CART_FULL_MORE_DEVICE_ITEMS_SINGULAR : StringId.IDS_CART_FULL_MORE_DEVICE_ITEMS_PLURAL; ErrorDialogInfo.Show(HRESULT._NS_E_CART_MORE_ITEMS_AVAILABLE.Int, Shell.LoadString(StringId.IDS_CART_FULL), string.Format(Shell.LoadString(stringId), extraCartItems)); }
public static void ErrorMessageTooManyNewItems() => ErrorDialogInfo.Show(HRESULT._NS_E_CART_TOO_MANY_NEW_ITEMS.Int, Shell.LoadString(StringId.IDS_CART_FULL));
public static void ErrorMessageCartAlreadyFull() => ErrorDialogInfo.Show(HRESULT._NS_E_CART_FULL.Int, Shell.LoadString(StringId.IDS_CART_FULL));
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)); } } }