public async Task StoreListingSelected(StoreListingModel storeListing) { await this.window.RunAsyncOperation(async() => { this.LandingSearchGrid.Visibility = Visibility.Collapsed; this.DetailsGrid.Visibility = Visibility.Visible; this.BackButton.Visibility = Visibility.Visible; #pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed this.DetailsUserAvatar.SetUserAvatarUrl(storeListing.UserID); #pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed this.RateReviewButton.Visibility = (storeListing.IsCommandOwnedByUser) ? Visibility.Collapsed : Visibility.Visible; this.ReportButton.Visibility = (storeListing.IsCommandOwnedByUser) ? Visibility.Collapsed : Visibility.Visible; this.RemoveButton.Visibility = (storeListing.IsCommandOwnedByUser) ? Visibility.Visible : Visibility.Collapsed; this.DetailsGrid.DataContext = this.currentListing = await ChannelSession.Services.MixItUpService.GetStoreListing(storeListing.ID); this.currentReviews.Clear(); foreach (StoreListingReviewModel review in this.currentListing.Reviews) { this.currentReviews.Add(new ListingUserReviewControl(review)); } }); }
public async Task <StoreDetailListingModel> GetStoreListing(Guid ID) { StoreDetailListingModel listing = await this.GetAsync <StoreDetailListingModel>("store/details?id=" + ID); if (listing != null) { await listing.SetUser(); await listing.SetReviewUsers(); } return(listing); }
private async void DownloadButton_Click(object sender, RoutedEventArgs e) { await this.window.RunAsyncOperation(async() => { StoreDetailListingModel listingDetails = await ChannelSession.Services.MixItUpService.GetStoreListing(this.currentListing.ID); await ChannelSession.Services.MixItUpService.AddStoreListingDownload(this.currentListing); List <ActionBase> actions = listingDetails.GetActions(); StoreCommandUpgrader.PerformUpgrades(actions, listingDetails.AppVersion); if (listingDetails.AssetsIncluded && listingDetails.AssetData != null && listingDetails.AssetData.Length > 0) { if (await MessageBoxHelper.ShowConfirmationDialog("This command contains included assets." + Environment.NewLine + "Would you like to download them?")) { string folderLocation = ChannelSession.Services.FileService.ShowOpenFolderDialog(); if (!string.IsNullOrEmpty(folderLocation)) { string zipFilePath = Path.Combine(ChannelSession.Services.FileService.GetTempFolder(), listingDetails.ID.ToString() + ".zip"); await ChannelSession.Services.FileService.SaveFileAsBytes(zipFilePath, listingDetails.AssetData); await ChannelSession.Services.FileService.UnzipFiles(zipFilePath, folderLocation); IEnumerable <string> assetFileNames = (await ChannelSession.Services.FileService.GetFilesInDirectory(folderLocation)).Select(s => Path.GetFileName(s)); foreach (ActionBase action in actions) { if (action.Type == ActionTypeEnum.Overlay) { OverlayAction oAction = (OverlayAction)action; if (oAction.Effect is OverlayImageEffect) { OverlayImageEffect iEffect = (OverlayImageEffect)oAction.Effect; if (assetFileNames.Contains(Path.GetFileName(iEffect.FilePath))) { iEffect.FilePath = Path.Combine(folderLocation, Path.GetFileName(iEffect.FilePath)); } } } else if (action.Type == ActionTypeEnum.Sound) { SoundAction sAction = (SoundAction)action; if (assetFileNames.Contains(Path.GetFileName(sAction.FilePath))) { sAction.FilePath = Path.Combine(folderLocation, Path.GetFileName(sAction.FilePath)); } } } } } } this.window.DownloadCommandFromStore(listingDetails.ID, actions); }); }
public async Task StoreListingSelected(StoreListingModel storeListing) { await this.window.RunAsyncOperation(async() => { this.LandingSearchGrid.Visibility = Visibility.Collapsed; this.DetailsGrid.Visibility = Visibility.Visible; this.BackButton.Visibility = Visibility.Visible; this.RateReviewButton.Visibility = (storeListing.IsCommandOwnedByUser) ? Visibility.Collapsed : Visibility.Visible; this.ReportButton.Visibility = (storeListing.IsCommandOwnedByUser) ? Visibility.Collapsed : Visibility.Visible; this.RemoveButton.Visibility = (storeListing.IsCommandOwnedByUser) ? Visibility.Visible : Visibility.Collapsed; this.DetailsGrid.DataContext = this.currentListing = await ChannelSession.Services.MixItUpService.GetStoreListing(storeListing.ID); }); }
public async Task StoreListingSelected(StoreListingModel storeListing) { await this.window.RunAsyncOperation(async() => { this.LandingSearchGrid.Visibility = Visibility.Collapsed; this.DetailsGrid.Visibility = Visibility.Visible; this.BackButton.Visibility = Visibility.Visible; this.DetailsUserAvatar.SetImageUrl(storeListing.UserAvatar); this.RateReviewButton.Visibility = (storeListing.IsCommandOwnedByUser) ? Visibility.Collapsed : Visibility.Visible; this.ReportButton.Visibility = (storeListing.IsCommandOwnedByUser) ? Visibility.Collapsed : Visibility.Visible; this.RemoveButton.Visibility = (storeListing.IsCommandOwnedByUser) ? Visibility.Visible : Visibility.Collapsed; this.DetailsGrid.DataContext = this.currentListing = await ChannelSession.Services.MixItUpService.GetStoreListing(storeListing.ID); this.currentReviews.Clear(); foreach (StoreListingReviewModel review in this.currentListing.Reviews) { this.currentReviews.Add(new ListingUserReviewControl(review)); } }); }
public async Task UpdateStoreListing(StoreDetailListingModel listing) { await this.PutAsync("store/details", listing); }
public async Task AddStoreListing(StoreDetailListingModel listing) { await this.PostAsync("store/details", listing); }
private async void DownloadButton_Click(object sender, RoutedEventArgs e) { await this.window.RunAsyncOperation(async() => { StoreDetailListingModel listingDetails = await ChannelSession.Services.MixItUpService.GetStoreListing(this.currentListing.ID); if (listingDetails == null) { await MessageBoxHelper.ShowMessageDialog("Failed to download command, please try again"); return; } Version assemblyVersion = Assembly.GetExecutingAssembly().GetName().Version; Version commandVersion = new Version(listingDetails.AppVersion); if (assemblyVersion < commandVersion) { await MessageBoxHelper.ShowMessageDialog(string.Format("You can not download this command as it was created on version ({0}) of Mix It Up ", commandVersion)); return; } await ChannelSession.Services.MixItUpService.AddStoreListingDownload(listingDetails); List <ActionBase> actions = listingDetails.GetActions(); StoreCommandUpgrader.PerformUpgrades(actions, listingDetails.AppVersion); if (listingDetails.AssetsIncluded && listingDetails.AssetData != null && listingDetails.AssetData.Length > 0) { if (await MessageBoxHelper.ShowConfirmationDialog("This command contains included assets." + Environment.NewLine + "Would you like to download them?")) { string folderLocation = ChannelSession.Services.FileService.ShowOpenFolderDialog(); if (!string.IsNullOrEmpty(folderLocation)) { string zipFilePath = Path.Combine(ChannelSession.Services.FileService.GetTempFolder(), listingDetails.ID.ToString() + ".zip"); await ChannelSession.Services.FileService.SaveFileAsBytes(zipFilePath, listingDetails.AssetData); await ChannelSession.Services.FileService.UnzipFiles(zipFilePath, folderLocation); IEnumerable <string> assetFileNames = (await ChannelSession.Services.FileService.GetFilesInDirectory(folderLocation)).Select(s => Path.GetFileName(s)); foreach (ActionBase action in actions) { if (action.Type == ActionTypeEnum.Overlay) { OverlayAction oAction = (OverlayAction)action; if (oAction.Item is OverlayImageItem) { OverlayImageItem overlayItem = (OverlayImageItem)oAction.Item; if (assetFileNames.Contains(Path.GetFileName(overlayItem.FilePath))) { overlayItem.FilePath = Path.Combine(folderLocation, Path.GetFileName(overlayItem.FilePath)); } } } else if (action.Type == ActionTypeEnum.Sound) { SoundAction sAction = (SoundAction)action; if (assetFileNames.Contains(Path.GetFileName(sAction.FilePath))) { sAction.FilePath = Path.Combine(folderLocation, Path.GetFileName(sAction.FilePath)); } } } } } } this.window.DownloadCommandFromStore(listingDetails.ID, actions); }); }