Use service proxy where available

This commit is contained in:
Yoshi Askharoun
2022-06-06 15:08:07 -05:00
parent d95fd24720
commit 01f8df1525
32 changed files with 122 additions and 121 deletions
@@ -54,7 +54,8 @@ namespace Microsoft.Zune.Shell
public static ZuneLibrary ZuneLibrary => _zuneLibrary;
public static Service.Service2 Service => Zune.Service.Service2.Instance;
public static Service.Service Service => Zune.Service.Service.Instance;
public static Service.Service2 Service2 => Zune.Service.Service2.Instance;
public static event EventHandler Closing;
+1 -1
View File
@@ -16,7 +16,7 @@ namespace ZuneUI
{
int dbMediaId = -1;
bool fHidden = false;
return !ZuneApplication.Service.InCompleteCollection(serviceMediaId, EContentType.Artist, out dbMediaId, out fHidden) ? -1 : dbMediaId;
return !ZuneApplication.Service2.InCompleteCollection(serviceMediaId, EContentType.Artist, out dbMediaId, out fHidden) ? -1 : dbMediaId;
}
}
}
+2 -2
View File
@@ -169,10 +169,10 @@ namespace ZuneUI
string uriOut = null;
if (this.m_videoOffers[0] is VideoOffer videoOffer)
{
if (!ZuneApplication.Service.InCompleteCollection(videoOffer.Id, EContentType.Video) && !string.IsNullOrEmpty(this.m_uri))
if (!ZuneApplication.Service2.InCompleteCollection(videoOffer.Id, EContentType.Video) && !string.IsNullOrEmpty(this.m_uri))
uriOut = this.m_uri;
else
ZuneApplication.Service.GetContentUri(videoOffer.Id, EContentType.Video, EContentUriFlags.BypassLicense | EContentUriFlags.IgnoreCollection, videoOffer.IsHD, videoOffer.IsRental, out uriOut);
ZuneApplication.Service2.GetContentUri(videoOffer.Id, EContentType.Video, EContentUriFlags.BypassLicense | EContentUriFlags.IgnoreCollection, videoOffer.IsHD, videoOffer.IsRental, out uriOut);
}
return uriOut;
}
+7 -7
View File
@@ -29,20 +29,20 @@ namespace ZuneUI
public void GetSubscriptionOffers()
{
this.ErrorCode = HRESULT._S_OK;
ZuneApplication.Service.GetSubscriptionOffers(new GetBillingOffersCompleteCallback(this.OnGetSubscriptionsComplete), new GetBillingOffersErrorCallback(this.OnGetSubscriptionsError));
ZuneApplication.Service2.GetSubscriptionOffers(new GetBillingOffersCompleteCallback(this.OnGetSubscriptionsComplete), new GetBillingOffersErrorCallback(this.OnGetSubscriptionsError));
}
public void GetPointsOffers()
{
this.ErrorCode = HRESULT._S_OK;
ZuneApplication.Service.GetPointsOffers(new GetBillingOffersCompleteCallback(this.OnGetPointsOffersComplete), new GetBillingOffersErrorCallback(this.OnGetPointsOffersError));
ZuneApplication.Service2.GetPointsOffers(new GetBillingOffersCompleteCallback(this.OnGetPointsOffersComplete), new GetBillingOffersErrorCallback(this.OnGetPointsOffersError));
}
public void GetCurrentSubscription()
{
this.ErrorCode = HRESULT._S_OK;
if (SignIn.Instance.SignedInWithSubscription)
ZuneApplication.Service.GetSubscriptionDetails(SignIn.Instance.SubscriptionId, new GetBillingOffersCompleteCallback(this.OnGetCurrentSubscriptionComplete), new GetBillingOffersErrorCallback(this.OnGetCurrentSubscriptionError));
ZuneApplication.Service2.GetSubscriptionDetails(SignIn.Instance.SubscriptionId, new GetBillingOffersCompleteCallback(this.OnGetCurrentSubscriptionComplete), new GetBillingOffersErrorCallback(this.OnGetCurrentSubscriptionError));
else
this.CurrentSubscription = null;
}
@@ -52,7 +52,7 @@ namespace ZuneUI
this.ErrorCode = HRESULT._S_OK;
ulong subscriptionRenewalId = SignIn.Instance.SubscriptionRenewalId;
if (SignIn.Instance.SignedInWithSubscription && subscriptionRenewalId != 0UL)
ZuneApplication.Service.GetSubscriptionDetails(subscriptionRenewalId, new GetBillingOffersCompleteCallback(this.OnGetRenewalSubscriptionComplete), new GetBillingOffersErrorCallback(this.OnGetRenewalSubscriptionError));
ZuneApplication.Service2.GetSubscriptionDetails(subscriptionRenewalId, new GetBillingOffersCompleteCallback(this.OnGetRenewalSubscriptionComplete), new GetBillingOffersErrorCallback(this.OnGetRenewalSubscriptionError));
else
this.RenewalSubscription = null;
}
@@ -63,13 +63,13 @@ namespace ZuneUI
if (billingOffer == null)
return;
AsyncCompleteHandler callback = billingOffer.OfferType != EBillingOfferType.Points ? new AsyncCompleteHandler(this.OnPurchaseSubscriptionComplete) : new AsyncCompleteHandler(this.OnPurchasePointsComplete);
ZuneApplication.Service.PurchaseBillingOffer(billingOffer, paymentInstrument, callback);
ZuneApplication.Service2.PurchaseBillingOffer(billingOffer, paymentInstrument, callback);
}
public static bool IsSubscribed(BillingOffer offer)
{
bool flag = false;
if (offer != null && ZuneApplication.Service.IsSignedInWithSubscription())
if (offer != null && ZuneApplication.Service2.IsSignedInWithSubscription())
flag = (long)SignIn.Instance.SubscriptionId == (long)offer.Id;
return flag;
}
@@ -77,7 +77,7 @@ namespace ZuneUI
public static bool IsSubscriptionChanging()
{
bool flag = false;
if (ZuneApplication.Service.IsSignedInWithSubscription())
if (ZuneApplication.Service2.IsSignedInWithSubscription())
flag = (long)SignIn.Instance.SubscriptionRenewalId != (long)SignIn.Instance.SubscriptionId;
return flag;
}
@@ -40,7 +40,7 @@ namespace ZuneUI
this.Description = Shell.LoadString(StringId.IDS_INCOLLECTION);
this.Available = true;
}
else if (ZuneApplication.Service.IsDownloading(this.Id, EContentType.MusicTrack, out fIsDownloadPending, out fIsHidden))
else if (ZuneApplication.Service2.IsDownloading(this.Id, EContentType.MusicTrack, out fIsDownloadPending, out fIsHidden))
{
this.Description = Shell.LoadString(StringId.IDS_PENDING);
this.Downloading = true;
@@ -64,7 +64,7 @@ namespace ZuneUI
public override void FindInCollection() => MusicLibraryPage.FindInCollection(-1, -1, this.CollectionId);
public bool CanAddToCollection => this._lastSignedInUserHadActiveSubscription && ZuneApplication.Service.InHiddenCollection(this.Id, EContentType.MusicTrack);
public bool CanAddToCollection => this._lastSignedInUserHadActiveSubscription && ZuneApplication.Service2.InHiddenCollection(this.Id, EContentType.MusicTrack);
public bool CanDownload => this._lastSignedInUserHadActiveSubscription && !this.CanFindInCollection && (!this.CanAddToCollection && !this.Downloading) && this.Id != Guid.Empty && Download.Instance.GetErrorCode(this.Id) != HRESULT._ZUNE_E_NO_SUBSCRIPTION_DOWNLOAD_RIGHTS.Int;
@@ -20,7 +20,7 @@ namespace ZuneUI
public static void ShowDialog()
{
string subscriptionDirectory = ZuneApplication.Service.GetSubscriptionDirectory();
string subscriptionDirectory = ZuneApplication.Service2.GetSubscriptionDirectory();
if (string.IsNullOrEmpty(subscriptionDirectory))
MessageBox.Show(Shell.LoadString(StringId.IDS_ACCOUNT_CLEAR_SUB_FAIL_TITLE), Shell.LoadString(StringId.IDS_ACCOUNT_CLEAR_SUB_NO_DIRECTORY), null);
else
@@ -62,7 +62,7 @@ namespace ZuneUI
if (!this.Enabled)
return;
this.Enabled = false;
ZuneApplication.Service.DeleteSubscriptionDownloads(new AsyncCompleteHandler(this.OnDeleteComplete));
ZuneApplication.Service2.DeleteSubscriptionDownloads(new AsyncCompleteHandler(this.OnDeleteComplete));
}
private void OnDeleteComplete(HRESULT hr) => Application.DeferredInvoke(new DeferredInvokeHandler(this.DeferredDeleteCompleteEvent), hr);
+5 -5
View File
@@ -76,7 +76,7 @@ namespace ZuneUI
string deviceEndpointId,
EventHandler onAllPending)
{
ZuneApplication.Service.Download(items, eDownloadFlags, deviceEndpointId, this.ClientContextEvent, this.ClientContextEventValue, new DownloadEventHandler(this.OnDownloadEvent), new DownloadEventProgressHandler(this.OnDownloadProgressEvent), onAllPending);
ZuneApplication.Service2.Download(items, eDownloadFlags, deviceEndpointId, this.ClientContextEvent, this.ClientContextEventValue, new DownloadEventHandler(this.OnDownloadEvent), new DownloadEventProgressHandler(this.OnDownloadProgressEvent), onAllPending);
if ((eDownloadFlags & ~(EDownloadFlags.CanBeOffline | EDownloadFlags.Subscription)) != EDownloadFlags.None)
return;
bool flag = ZuneShell.DefaultInstance.CurrentPage is InboxPage;
@@ -88,7 +88,7 @@ namespace ZuneUI
public void AddToCollection(IList items)
{
ZuneApplication.Service.Download(items, EDownloadFlags.Subscription, null, this.ClientContextEvent, this.ClientContextEventValue, new DownloadEventHandler(this.OnDownloadEvent), new DownloadEventProgressHandler(this.OnDownloadProgressEvent), new EventHandler(this.OnAllPending));
ZuneApplication.Service2.Download(items, EDownloadFlags.Subscription, null, this.ClientContextEvent, this.ClientContextEventValue, new DownloadEventHandler(this.OnDownloadEvent), new DownloadEventProgressHandler(this.OnDownloadProgressEvent), new EventHandler(this.OnAllPending));
foreach (object obj in items)
{
if (obj is DataProviderObject)
@@ -117,10 +117,10 @@ namespace ZuneUI
public bool IsDownloading(Guid mediaId, EContentType eContentType, out bool fPending)
{
bool fIsHidden = false;
return ZuneApplication.Service.IsDownloading(mediaId, eContentType, out fPending, out fIsHidden);
return ZuneApplication.Service2.IsDownloading(mediaId, eContentType, out fPending, out fIsHidden);
}
public void CancelDownload(Guid mediaId) => ZuneApplication.Service.CancelDownload(mediaId, EContentType.MusicTrack);
public void CancelDownload(Guid mediaId) => ZuneApplication.Service2.CancelDownload(mediaId, EContentType.MusicTrack);
public int ErrorCount => this.m_errors.Count;
@@ -143,7 +143,7 @@ namespace ZuneUI
internal void Phase3Init()
{
DownloadManager.Instance.OnProgressChanged += new DownloadManagerUpdateHandler(this.OnProgressChanged);
ZuneApplication.Service.RegisterForDownloadNotification(new DownloadEventHandler(this.OnDownloadEvent), new DownloadEventProgressHandler(this.OnDownloadProgressEvent), new EventHandler(this.OnAllPending));
ZuneApplication.Service2.RegisterForDownloadNotification(new DownloadEventHandler(this.OnDownloadEvent), new DownloadEventProgressHandler(this.OnDownloadProgressEvent), new EventHandler(this.OnAllPending));
SingletonModelItem<TransportControls>.Instance.PropertyChanged += new PropertyChangedEventHandler(this.OnTransportControlPropertyChanged);
}
+2 -2
View File
@@ -34,7 +34,7 @@ namespace ZuneUI
flag = true;
break;
case DrmState.Expiring:
DRMInfo fileDrmInfo = ZuneApplication.Service.GetFileDRMInfo(filename);
DRMInfo fileDrmInfo = ZuneApplication.Service2.GetFileDRMInfo(filename);
if (fileDrmInfo != null && (fileDrmInfo.NoLicense || fileDrmInfo.LicenseExpired))
{
flag = true;
@@ -54,7 +54,7 @@ namespace ZuneUI
flag = true;
break;
case DrmState.Expiring:
DRMInfo mediaDrmInfo = ZuneApplication.Service.GetMediaDRMInfo(mediaId, EContentType.Video);
DRMInfo mediaDrmInfo = ZuneApplication.Service2.GetMediaDRMInfo(mediaId, EContentType.Video);
if (mediaDrmInfo != null && (mediaDrmInfo.NoLicense || mediaDrmInfo.LicenseExpired))
{
flag = true;
+1 -1
View File
@@ -59,7 +59,7 @@ namespace ZuneUI
PodcastLibraryPage.FindInCollection((int)this.m_episode.GetProperty("SeriesId"), (int)this.m_episode.GetProperty("LibraryId"));
break;
default:
if (this.m_requireSignIn && !SignIn.Instance.SignedIn || this.m_explicit && ZuneApplication.Service.BlockExplicitContent())
if (this.m_requireSignIn && !SignIn.Instance.SignedIn || this.m_explicit && ZuneApplication.Service2.BlockExplicitContent())
break;
DownloadEpisode(this.m_episode);
this.Refresh();
+1 -1
View File
@@ -13,6 +13,6 @@ namespace ZuneUI
{
public class HelpCommandHandler : ICommandHandler
{
public void Execute(string command, IDictionary commandArgs) => ZuneApplication.Service.LaunchBrowserForExternalUrl((string)Registry.LocalMachine.OpenSubKey("Software\\Microsoft\\Zune").GetValue("Installation Directory") + command, EPassportPolicyId.None);
public void Execute(string command, IDictionary commandArgs) => ZuneApplication.Service2.LaunchBrowserForExternalUrl((string)Registry.LocalMachine.OpenSubKey("Software\\Microsoft\\Zune").GetValue("Installation Directory") + command, EPassportPolicyId.None);
}
}
+1 -1
View File
@@ -204,7 +204,7 @@ namespace ZuneUI
}
}
if (string.IsNullOrEmpty(uriOut) && this.ZuneMediaId != Guid.Empty)
hresult = ZuneApplication.Service.GetContentUri(this.ZuneMediaId, eContentType, Microsoft.Zune.Service.EContentUriFlags.None, out uriOut, out this._zuneMediaInstanceId);
hresult = ZuneApplication.Service2.GetContentUri(this.ZuneMediaId, eContentType, Microsoft.Zune.Service.EContentUriFlags.None, out uriOut, out this._zuneMediaInstanceId);
uri = uriOut;
return hresult;
}
@@ -30,7 +30,7 @@ namespace ZuneUI
bool fIsHidden = false;
if (this.AllowDownload)
{
if (ZuneApplication.Service.IsDownloading(this.Id, this.ContentType, out fIsDownloadPending, out fIsHidden))
if (ZuneApplication.Service2.IsDownloading(this.Id, this.ContentType, out fIsDownloadPending, out fIsHidden))
{
this.Downloading = true;
if (fIsDownloadPending)
+6 -6
View File
@@ -35,11 +35,11 @@ namespace ZuneUI
public virtual bool CanFindInCollection => this.m_collectionId >= 0;
public virtual bool CanFindInCollectionShortcut => this.m_collectionId >= 0 && ZuneApplication.Service.GetMediaStatus(this.Id, this.ContentType) == EMediaStatus.StatusInCollectionShortcut;
public virtual bool CanFindInCollectionShortcut => this.m_collectionId >= 0 && ZuneApplication.Service2.GetMediaStatus(this.Id, this.ContentType) == EMediaStatus.StatusInCollectionShortcut;
public virtual bool CanFindInCollectionOwned => this.m_collectionId >= 0 && ZuneApplication.Service.GetMediaStatus(this.Id, this.ContentType) == EMediaStatus.StatusInCollectionOwned;
public virtual bool CanFindInCollectionOwned => this.m_collectionId >= 0 && ZuneApplication.Service2.GetMediaStatus(this.Id, this.ContentType) == EMediaStatus.StatusInCollectionOwned;
public virtual bool CanFindInHiddenCollection => ZuneApplication.Service.InHiddenCollection(this.Id, this.ContentType);
public virtual bool CanFindInHiddenCollection => ZuneApplication.Service2.InHiddenCollection(this.Id, this.ContentType);
public virtual bool ShowHiddenProgress
{
@@ -132,18 +132,18 @@ namespace ZuneUI
if (this.AllowDownload)
{
int dbMediaId;
if (ZuneApplication.Service.InVisibleCollection(this.Id, this.ContentType, out dbMediaId))
if (ZuneApplication.Service2.InVisibleCollection(this.Id, this.ContentType, out dbMediaId))
{
this.Description = Shell.LoadString(StringId.IDS_INCOLLECTION);
this.Available = true;
this.CollectionId = dbMediaId;
}
else if (ZuneApplication.Service.InHiddenCollection(this.Id, this.ContentType))
else if (ZuneApplication.Service2.InHiddenCollection(this.Id, this.ContentType))
{
this.Description = Shell.LoadString(this.AddToCollectionStringId);
this.Available = true;
}
else if (ZuneApplication.Service.IsDownloading(this.Id, this.ContentType, out fIsDownloadPending, out fIsHidden) && (!fIsHidden || this.ShowHiddenProgress))
else if (ZuneApplication.Service2.IsDownloading(this.Id, this.ContentType, out fIsDownloadPending, out fIsHidden) && (!fIsHidden || this.ShowHiddenProgress))
{
this.Downloading = true;
this.Available = true;
+2 -2
View File
@@ -57,8 +57,8 @@ namespace ZuneUI
public override HRESULT GetURI(out string uri)
{
string uriOut = null;
if (ZuneApplication.Service.InCompleteCollection(this._zuneMediaId, Microsoft.Zune.Service.EContentType.MusicTrack))
ZuneApplication.Service.GetContentUri(this._zuneMediaId, Microsoft.Zune.Service.EContentType.MusicTrack, Microsoft.Zune.Service.EContentUriFlags.FallbackToPreview, out uriOut, out Guid _);
if (ZuneApplication.Service2.InCompleteCollection(this._zuneMediaId, Microsoft.Zune.Service.EContentType.MusicTrack))
ZuneApplication.Service2.GetContentUri(this._zuneMediaId, Microsoft.Zune.Service.EContentType.MusicTrack, Microsoft.Zune.Service.EContentUriFlags.FallbackToPreview, out uriOut, out Guid _);
if (string.IsNullOrEmpty(uriOut))
uriOut = "vnd.ms.zunecp://CP/?ContentPartnerKeyName=zune&StreamType=Music&TrackID=" + this._zuneMediaId.ToString();
uri = uriOut;
+2 -2
View File
@@ -24,13 +24,13 @@ namespace ZuneUI
this.m_defaultPaymentInstrument = null;
this.m_creditCards = null;
this.ErrorCode = HRESULT._S_OK;
ZuneApplication.Service.GetPaymentInstruments(new GetPaymentInstrumentsCompleteCallback(this.OnGetPaymentInstrumentsSuccess), new GetPaymentInstrumentsErrorCallback(this.OnGetPaymentInstrumnetsError));
ZuneApplication.Service2.GetPaymentInstruments(new GetPaymentInstrumentsCompleteCallback(this.OnGetPaymentInstrumentsSuccess), new GetPaymentInstrumentsErrorCallback(this.OnGetPaymentInstrumnetsError));
}
public void AddPaymentInstrument(PaymentInstrument paymentInstrument)
{
this.ErrorCode = HRESULT._S_OK;
ZuneApplication.Service.AddPaymentInstrument(paymentInstrument, new AddPaymentInstrumentCompleteCallback(this.OnAddPaymentInstrumentSuccess), new AddPaymentInstrumentErrorCallback(this.OnAddPaymentInstrumnetError));
ZuneApplication.Service2.AddPaymentInstrument(paymentInstrument, new AddPaymentInstrumentCompleteCallback(this.OnAddPaymentInstrumentSuccess), new AddPaymentInstrumentErrorCallback(this.OnAddPaymentInstrumnetError));
}
public IList CreditCards => this.m_creditCards == null ? null : this.m_creditCards.Items;
+2 -2
View File
@@ -583,7 +583,7 @@ namespace ZuneUI
}
else
{
if (!ZuneApplication.Service.InCompleteCollection(track.Id, Microsoft.Zune.Service.EContentType.MusicTrack, out dbMediaId, out bool _) && materializeMarketplaceTracks && (track.IsDownloading || track.CanDownload || track.CanPurchase))
if (!ZuneApplication.Service2.InCompleteCollection(track.Id, Microsoft.Zune.Service.EContentType.MusicTrack, out dbMediaId, out bool _) && materializeMarketplaceTracks && (track.IsDownloading || track.CanDownload || track.CanPurchase))
dbMediaId = ZuneApplication.ZuneLibrary.AddTrack(track.Id, track.AlbumId, track.TrackNumber, track.Title, track.Duration, track.AlbumTitle, track.Artist, track.PrimaryGenre.Title);
if (dbMediaId >= 0)
{
@@ -675,7 +675,7 @@ namespace ZuneUI
if (marketplacePlaybackTrack == null)
return;
int dbMediaId;
if (!ZuneApplication.Service.InCompleteCollection(marketplacePlaybackTrack.ZuneMediaId, Microsoft.Zune.Service.EContentType.MusicTrack, out dbMediaId, out bool _))
if (!ZuneApplication.Service2.InCompleteCollection(marketplacePlaybackTrack.ZuneMediaId, Microsoft.Zune.Service.EContentType.MusicTrack, out dbMediaId, out bool _))
dbMediaId = ZuneApplication.ZuneLibrary.AddTrack(marketplacePlaybackTrack.ZuneMediaId, marketplacePlaybackTrack.AlbumId, marketplacePlaybackTrack.TrackNumber, marketplacePlaybackTrack.Title, marketplacePlaybackTrack.Duration, marketplacePlaybackTrack.Album, marketplacePlaybackTrack.Artist, marketplacePlaybackTrack.Genre);
if (dbMediaId < 0)
return;
+5 -5
View File
@@ -108,7 +108,7 @@ namespace ZuneUI
eGetOffersFlags |= EGetOffersFlags.SeasonPurchase;
if (subscriptionFreeTracksOnly)
eGetOffersFlags |= EGetOffersFlags.SubscriptionFreeTracks;
ZuneApplication.Service.GetOffers(guidAlbumIds, guidTrackIds, guidVideoIds, guidAppIds, mapIdToContext, eGetOffersFlags, deviceEndpointId, new GetOffersCompleteCallback(this.OnGetOffersComplete), new GetOffersErrorCallback(this.OnGetOffersError));
ZuneApplication.Service2.GetOffers(guidAlbumIds, guidTrackIds, guidVideoIds, guidAppIds, mapIdToContext, eGetOffersFlags, deviceEndpointId, new GetOffersCompleteCallback(this.OnGetOffersComplete), new GetOffersErrorCallback(this.OnGetOffersError));
}
private void UpdateContextMap(
@@ -151,26 +151,26 @@ namespace ZuneUI
if (!this.m_fRequestingBalances)
{
this.m_fRequestingBalances = true;
ZuneApplication.Service.GetBalances(new GetBalancesCompleteCallback(this.OnGetBalancesComplete), new GetBalancesErrorCallback(this.OnGetBalancesError));
ZuneApplication.Service2.GetBalances(new GetBalancesCompleteCallback(this.OnGetBalancesComplete), new GetBalancesErrorCallback(this.OnGetBalancesError));
}
if (this.m_fRequestingPointsOffers || this.m_pointsOffers != null)
return;
this.m_fRequestingPointsOffers = true;
ZuneApplication.Service.GetPointsOffers(new GetBillingOffersCompleteCallback(this.OnGetPointsOffersComplete), new GetBillingOffersErrorCallback(this.OnGetPointsOffersError));
ZuneApplication.Service2.GetPointsOffers(new GetBillingOffersCompleteCallback(this.OnGetPointsOffersComplete), new GetBillingOffersErrorCallback(this.OnGetPointsOffersError));
}
public void PurchaseOffers(PaymentInstrument payment)
{
this.ErrorMessage = null;
this.ErrorWebHelpUrl = null;
ZuneApplication.Service.PurchaseOffers(payment, this.m_albumOfferCollection, this.m_trackOfferCollection, this.m_videoOfferCollection, this.m_appOfferCollection, this.PurchaseOffersFlags, new PurchaseOffersCompleteHandler(this.OnPurchaseOffersComplete));
ZuneApplication.Service2.PurchaseOffers(payment, this.m_albumOfferCollection, this.m_trackOfferCollection, this.m_videoOfferCollection, this.m_appOfferCollection, this.PurchaseOffersFlags, new PurchaseOffersCompleteHandler(this.OnPurchaseOffersComplete));
if (this.RentVideos)
this.Status = Shell.LoadString(StringId.IDS_PURCHASE_RENTAL_IN_PROGRESS);
else
this.Status = Shell.LoadString(StringId.IDS_PURCHASE_IN_PROGRESS);
}
public void ResumePurchase(string purchaseHandle, string token) => ZuneApplication.Service.ResumePurchase(purchaseHandle, token, new AsyncCompleteHandler(this.OnResumePurchaseComplete));
public void ResumePurchase(string purchaseHandle, string token) => ZuneApplication.Service2.ResumePurchase(purchaseHandle, token, new AsyncCompleteHandler(this.OnResumePurchaseComplete));
public void PurchaseBestPointsOffer(PaymentInstrument paymentInstrument)
{
+5 -5
View File
@@ -32,7 +32,7 @@ namespace ZuneUI
{
if (!(track.Id == Guid.Empty))
{
bool flag2 = ZuneApplication.Service.InVisibleCollection(track.Id, EContentType.MusicTrack);
bool flag2 = ZuneApplication.Service2.InVisibleCollection(track.Id, EContentType.MusicTrack);
if (filterType == TrackCollectionFilterType.IncludeIfAnyTrackNotInCollection)
{
if (!flag2)
@@ -60,7 +60,7 @@ namespace ZuneUI
{
bool flag = false;
if (artistId != Guid.Empty)
flag = ZuneApplication.Service.InVisibleCollection(artistId, EContentType.Artist);
flag = ZuneApplication.Service2.InVisibleCollection(artistId, EContentType.Artist);
return flag;
}
@@ -121,7 +121,7 @@ namespace ZuneUI
if (id != Guid.Empty)
{
int piRating = 0;
if (ZuneApplication.Service.GetUserRating(SignIn.Instance.LastSignedInUserId, id, EContentType.MusicTrack, ref piRating))
if (ZuneApplication.Service2.GetUserRating(SignIn.Instance.LastSignedInUserId, id, EContentType.MusicTrack, ref piRating))
num = piRating;
}
}
@@ -134,14 +134,14 @@ namespace ZuneUI
if (item is Track)
{
Track track = (Track)item;
flag = ZuneApplication.Service.SetUserTrackRating(SignIn.Instance.LastSignedInUserId, rating, track.Id, track.AlbumId, track.TrackNumber, track.Title, track.Duration.Milliseconds, track.AlbumTitle, track.Artist, track.PrimaryGenre.Title, (string)track.GetProperty("ReferrerContext"));
flag = ZuneApplication.Service2.SetUserTrackRating(SignIn.Instance.LastSignedInUserId, rating, track.Id, track.AlbumId, track.TrackNumber, track.Title, track.Duration.Milliseconds, track.AlbumTitle, track.Artist, track.PrimaryGenre.Title, (string)track.GetProperty("ReferrerContext"));
if (flag)
track.UserRating = rating;
}
return flag;
}
public static bool SetArtistUserRating(Guid id, string name, int rating) => ZuneApplication.Service.SetUserArtistRating(SignIn.Instance.LastSignedInUserId, rating, id, name);
public static bool SetArtistUserRating(Guid id, string name, int rating) => ZuneApplication.Service2.SetUserArtistRating(SignIn.Instance.LastSignedInUserId, rating, id, name);
public static string GetRecommendationsEndpoint() => Service.GetEndPointUri(EServiceEndpointId.SEID_Recommendations);
+40 -40
View File
@@ -297,7 +297,7 @@ namespace ZuneUI
private void UpdatePointsBalance()
{
int pointsBalance = ZuneApplication.Service.GetPointsBalance();
int pointsBalance = ZuneApplication.Service2.GetPointsBalance();
if (pointsBalance == this.m_pointsBalance)
return;
this.m_pointsBalance = pointsBalance;
@@ -360,14 +360,14 @@ namespace ZuneUI
}
}
public void UpdateSubscriptionFreeTrackBalance() => this.SubscriptionFreeTrackBalance = ZuneApplication.Service.GetSubscriptionFreeTrackBalance();
public void UpdateSubscriptionFreeTrackBalance() => this.SubscriptionFreeTrackBalance = ZuneApplication.Service2.GetSubscriptionFreeTrackBalance();
public IList PersistedUsernames
{
get
{
if (this.m_persistedUsernames == null)
this.m_persistedUsernames = ZuneApplication.Service.GetPersistedUsernames();
this.m_persistedUsernames = ZuneApplication.Service2.GetPersistedUsernames();
return this.m_persistedUsernames;
}
set
@@ -751,9 +751,9 @@ namespace ZuneUI
this.UpdateMaxWindowsPhoneVersion();
}
public bool PasswordRequired(string strUsername) => ZuneApplication.Service.SignInPasswordRequired(strUsername);
public bool PasswordRequired(string strUsername) => ZuneApplication.Service2.SignInPasswordRequired(strUsername);
public bool SignInAtStartup(string strUsername) => ZuneApplication.Service.SignInAtStartup(strUsername);
public bool SignInAtStartup(string strUsername) => ZuneApplication.Service2.SignInAtStartup(strUsername);
public bool RememberUsername(string strUsername)
{
@@ -765,9 +765,9 @@ namespace ZuneUI
public void RefreshAccount()
{
if (!ZuneApplication.Service.IsSignedIn())
if (!ZuneApplication.Service2.IsSignedIn())
return;
ZuneApplication.Service.RefreshAccount(new AsyncCompleteHandler(this.OnManualSignIn));
ZuneApplication.Service2.RefreshAccount(new AsyncCompleteHandler(this.OnManualSignIn));
}
public void SignInUser(string strUsername, string strPassword)
@@ -786,12 +786,12 @@ namespace ZuneUI
bool fSignInAtStartup)
{
if (this.SigningIn)
ZuneApplication.Service.CancelSignIn();
ZuneApplication.Service2.CancelSignIn();
else if (this.SignedIn)
ZuneApplication.Service.SignOut();
ZuneApplication.Service2.SignOut();
if (strPassword == null || strPassword == this.PseudoPassword)
strPassword = string.Empty;
ZuneApplication.Service.SignIn(strUsername, strPassword, fRememberUsername, fRememberPassword, fSignInAtStartup, new AsyncCompleteHandler(this.OnManualSignIn));
ZuneApplication.Service2.SignIn(strUsername, strPassword, fRememberUsername, fRememberPassword, fSignInAtStartup, new AsyncCompleteHandler(this.OnManualSignIn));
this.UpdateState();
}
@@ -799,12 +799,12 @@ namespace ZuneUI
{
Guid guidFromPassportId = GetGuidFromPassportId(strUsername);
int iUserId = 0;
if (!ZuneApplication.Service.SetLastSignedInUserGuid(ref guidFromPassportId, out iUserId))
if (!ZuneApplication.Service2.SetLastSignedInUserGuid(ref guidFromPassportId, out iUserId))
return;
if (this.SigningIn)
ZuneApplication.Service.CancelSignIn();
ZuneApplication.Service2.CancelSignIn();
else if (this.SignedIn)
ZuneApplication.Service.SignOut();
ZuneApplication.Service2.SignOut();
this.LastSignedInUserId = iUserId;
this.LastSignedInUserGuid = guidFromPassportId;
this.UpdateState();
@@ -812,7 +812,7 @@ namespace ZuneUI
public void CancelSignIn()
{
ZuneApplication.Service.CancelSignIn();
ZuneApplication.Service2.CancelSignIn();
this.UpdateState();
}
@@ -820,7 +820,7 @@ namespace ZuneUI
private void SignOut(bool forget)
{
ZuneApplication.Service.SignOut();
ZuneApplication.Service2.SignOut();
if (forget)
this.ClearLastSignedIdUser();
this.UpdateState();
@@ -830,7 +830,7 @@ namespace ZuneUI
public void RemovePersistedUsername(string persistedUsername)
{
ZuneApplication.Service.RemovePersistedUsername(persistedUsername);
ZuneApplication.Service2.RemovePersistedUsername(persistedUsername);
int idFromPassportId = GetUserIdFromPassportId(persistedUsername);
if (idFromPassportId > 0)
UserManager.Instance.CleanupUserData(idFromPassportId);
@@ -953,13 +953,13 @@ namespace ZuneUI
internal void UpdateState()
{
this.SubscriptionMachineCountExceeded = ZuneApplication.Service.IsSignedInWithSubscription() && !ZuneApplication.Service.CanDownloadSubscriptionContent();
this.SubscriptionBillingViolation = ZuneApplication.Service.IsSignedInWithSubscription() && ZuneApplication.Service.HasSignInBillingViolation();
this.ShowLabelTakedownWarning = ZuneApplication.Service.HasSignInLabelTakedown();
this.SignedIn = ZuneApplication.Service.IsSignedIn();
this.SigningIn = !this.SignedIn && ZuneApplication.Service.IsSigningIn();
this.SignedInUsername = ZuneApplication.Service.GetSignedInUsername();
this.SignedInGeoId = ZuneApplication.Service.GetSignedInGeoId();
this.SubscriptionMachineCountExceeded = ZuneApplication.Service2.IsSignedInWithSubscription() && !ZuneApplication.Service2.CanDownloadSubscriptionContent();
this.SubscriptionBillingViolation = ZuneApplication.Service2.IsSignedInWithSubscription() && ZuneApplication.Service2.HasSignInBillingViolation();
this.ShowLabelTakedownWarning = ZuneApplication.Service2.HasSignInLabelTakedown();
this.SignedIn = ZuneApplication.Service2.IsSignedIn();
this.SigningIn = !this.SignedIn && ZuneApplication.Service2.IsSigningIn();
this.SignedInUsername = ZuneApplication.Service2.GetSignedInUsername();
this.SignedInGeoId = ZuneApplication.Service2.GetSignedInGeoId();
this.SignInErrorMessage = null;
this.SignInErrorWebHelpUrl = null;
this.SignInError = HRESULT._S_OK;
@@ -969,7 +969,7 @@ namespace ZuneUI
this.SignInHttpGoneError = false;
this.SignInCredentialsError = false;
this.SignInNoZuneAccountError = false;
this.UserGuid = (Guid)ZuneApplication.Service.GetUserGuid();
this.UserGuid = (Guid)ZuneApplication.Service2.GetUserGuid();
this.UpdatePointsBalance();
this.UpdateSubscriptionFreeTrackBalance();
this.UpdateSubscriptionFreeTrackExpiration();
@@ -980,13 +980,13 @@ namespace ZuneUI
{
int iUserId;
Guid guidUserGuid;
ZuneApplication.Service.GetLastSignedInUserGuid(out iUserId, out guidUserGuid);
ZuneApplication.Service2.GetLastSignedInUserGuid(out iUserId, out guidUserGuid);
this.LastSignedInUserId = iUserId;
this.LastSignedInUserGuid = guidUserGuid;
this.ZuneTag = ZuneApplication.Service.GetZuneTag();
this.IsParentallyControlled = ZuneApplication.Service.IsParentallyControlled();
this.IsLightWeight = ZuneApplication.Service.IsLightWeight();
string locale = ZuneApplication.Service.GetLocale();
this.ZuneTag = ZuneApplication.Service2.GetZuneTag();
this.IsParentallyControlled = ZuneApplication.Service2.IsParentallyControlled();
this.IsLightWeight = ZuneApplication.Service2.IsLightWeight();
string locale = ZuneApplication.Service2.GetLocale();
if (!string.IsNullOrEmpty(locale))
{
string[] strArray = locale.Split('-');
@@ -1058,7 +1058,7 @@ namespace ZuneUI
DateTime maxValue2 = DateTime.MaxValue;
if (this.SignedIn)
{
dateTime1 = ZuneApplication.Service.GetSubscriptionFreeTrackExpiration();
dateTime1 = ZuneApplication.Service2.GetSubscriptionFreeTrackExpiration();
DateTime dateTime2 = !(dateTime1 >= DateTime.MinValue.Add(s_subscriptionFreeTrackFirstExpireWarning)) ? DateTime.MinValue : dateTime1.Subtract(s_subscriptionFreeTrackFirstExpireWarning);
DateTime dateTime3 = !(dateTime1 >= DateTime.MinValue.Add(s_subscriptionFreeTrackSecondExpireWarning)) ? DateTime.MinValue : dateTime1.Subtract(s_subscriptionFreeTrackSecondExpireWarning);
flag1 = dateTime2 <= DateTime.UtcNow;
@@ -1074,14 +1074,14 @@ namespace ZuneUI
bool flag1 = false;
bool flag2 = false;
DateTime dateTime = DateTime.MaxValue;
this.SignedInWithSubscription = ZuneApplication.Service.IsSignedInWithSubscription();
this.SignedInWithSubscription = ZuneApplication.Service2.IsSignedInWithSubscription();
if (this.SignedIn)
{
this.LastSignedInUserHadActiveSubscription = this.SignedInWithSubscription;
this.SubscriptionEndDate = ZuneApplication.Service.GetSubscriptionEndDate();
this.SubscriptionId = ZuneApplication.Service.GetSubscriptionOfferId();
this.SubscriptionRenewalId = ZuneApplication.Service.GetSubscriptionRenewalOfferId();
if (ZuneApplication.Service.SubscriptionPendingCancel() || this.SubscriptionRenewalId == 0UL)
this.SubscriptionEndDate = ZuneApplication.Service2.GetSubscriptionEndDate();
this.SubscriptionId = ZuneApplication.Service2.GetSubscriptionOfferId();
this.SubscriptionRenewalId = ZuneApplication.Service2.GetSubscriptionRenewalOfferId();
if (ZuneApplication.Service2.SubscriptionPendingCancel() || this.SubscriptionRenewalId == 0UL)
{
dateTime = !(this.SubscriptionEndDate >= DateTime.MinValue.Add(s_subscriptionEndingWarning)) ? DateTime.MinValue : this.SubscriptionEndDate.Subtract(s_subscriptionEndingWarning);
flag1 = !this.SignedInWithSubscription && this.SubscriptionHasEndDate && this.SubscriptionEndDate <= DateTime.Today;
@@ -1092,7 +1092,7 @@ namespace ZuneUI
{
bool activeSubscription;
ulong subscriptionId;
ZuneApplication.Service.GetLastSignedInUserSubscriptionState(out activeSubscription, out subscriptionId);
ZuneApplication.Service2.GetLastSignedInUserSubscriptionState(out activeSubscription, out subscriptionId);
this.LastSignedInUserHadActiveSubscription = activeSubscription;
this.SubscriptionId = subscriptionId;
this.SubscriptionEndDate = DateTime.MaxValue;
@@ -1147,11 +1147,11 @@ namespace ZuneUI
private bool AutomaticSignIn()
{
bool flag = false;
string atStartupUsername = ZuneApplication.Service.GetSignInAtStartupUsername();
string atStartupUsername = ZuneApplication.Service2.GetSignInAtStartupUsername();
if (atStartupUsername != null)
{
flag = true;
ZuneApplication.Service.SignIn(atStartupUsername, "", true, true, true, new AsyncCompleteHandler(this.OnAutomaticSignIn));
ZuneApplication.Service2.SignIn(atStartupUsername, "", true, true, true, new AsyncCompleteHandler(this.OnAutomaticSignIn));
}
return flag;
}
@@ -1166,12 +1166,12 @@ namespace ZuneUI
{
if (!(this.m_lastSignedInUserGuid == Guid.Empty) && this.m_iLastSignedInUserId != 0)
return;
ZuneApplication.Service.GetLastSignedInUserGuid(out this.m_iLastSignedInUserId, out this.m_lastSignedInUserGuid);
ZuneApplication.Service2.GetLastSignedInUserGuid(out this.m_iLastSignedInUserId, out this.m_lastSignedInUserGuid);
}
private void ClearLastSignedIdUser()
{
if (!ZuneApplication.Service.ClearLastSignedInUser())
if (!ZuneApplication.Service2.ClearLastSignedInUser())
return;
this.m_lastSignedInUserGuid = Guid.Empty;
this.m_iLastSignedInUserId = 0;
+2 -2
View File
@@ -1749,7 +1749,7 @@ namespace ZuneUI
case Track _:
Track track = (Track)dataProviderObject;
int dbMediaId1 = -1;
if (!ZuneApplication.Service.InCompleteCollection(track.Id, Microsoft.Zune.Service.EContentType.MusicTrack, out dbMediaId1, out bool _) && (track.IsDownloading || track.CanDownload || track.CanPurchase))
if (!ZuneApplication.Service2.InCompleteCollection(track.Id, Microsoft.Zune.Service.EContentType.MusicTrack, out dbMediaId1, out bool _) && (track.IsDownloading || track.CanDownload || track.CanPurchase))
dbMediaId1 = ZuneApplication.ZuneLibrary.AddTrack(track.Id, track.AlbumId, track.TrackNumber, track.Title, track.Duration, track.AlbumTitle, track.Artist, track.PrimaryGenre.Title);
if (dbMediaId1 >= 0)
{
@@ -1783,7 +1783,7 @@ namespace ZuneUI
case MusicVideo _:
MusicVideo musicVideo = (MusicVideo)dataProviderObject;
int dbMediaId2 = -1;
if (!ZuneApplication.Service.InCompleteCollection(musicVideo.Id, Microsoft.Zune.Service.EContentType.Video, out dbMediaId2, out bool _) && (musicVideo.IsDownloading || musicVideo.CanPurchase))
if (!ZuneApplication.Service2.InCompleteCollection(musicVideo.Id, Microsoft.Zune.Service.EContentType.Video, out dbMediaId2, out bool _) && (musicVideo.IsDownloading || musicVideo.CanPurchase))
dbMediaId2 = ZuneApplication.ZuneLibrary.AddVideo(musicVideo.Id, musicVideo.Title, musicVideo.Duration);
if (dbMediaId2 >= 0)
{

Some files were not shown because too many files have changed in this diff Show More