private void UpdateAssetControls() { Asset asset = Asset.Get(Convert.ToInt32(SessionAssetsListBox.SelectedValue)); AssetThumbnail1.Initialise(asset); AssetFilenameLabel.Text = asset.Filename; }
protected void RegenerateThumbnail_Click(object sender, EventArgs e) { try { if (APSGateway.Instance.ProcessFile(Asset, false, FileOutputs.Thumbnail)) { // Mark asset as unprocessed Asset.IsProcessed = false; Asset.Update(Asset); // Update the thumbnail AssetThumbnail1.Initialise(Asset); // Update the UI FeedbackLabel1.SetSuccessMessage("New thumbnail will be generated shortly"); } else { FeedbackLabel1.SetErrorMessage("An error occurred when submitting asset to processing service. Thumbnail will not be regenerated."); } } catch (InvalidAssetException iaex) { FeedbackLabel1.SetErrorMessage(iaex.Message); } catch (Exception ex) { ExceptionHandler.HandleException(ex, "Error regenerating thumbnail"); FeedbackLabel1.SetErrorMessage("Error regenerating thuumbnail: " + ex.Message); } }
protected void Page_Load(object sender, EventArgs e) { // Ensure we have asset id m_AssetId = GetRequiredQueryStringParameter("AssetId", "~/Admin/Assets/AssetList.aspx"); // Setup return link SiteUtils.SetHyperLink("Assets.AssetForm", string.Format("?AssetId={0}", m_AssetId), ReturnToAssetHyperLink1); SiteUtils.SetHyperLink("Assets.AssetForm", string.Format("?AssetId={0}", m_AssetId), ReturnToAssetHyperLink2); if (!Page.IsPostBack) { //Setup preview settings option AssetFileLabel.Text = Asset.Title + " (" + Asset.FileExtension + ")"; ProcessingStatusFalseRadioButton.Checked = (!Asset.IsProcessed); ProcessingStatusTrueRadioButton.Checked = Asset.IsProcessed; //set the default plugin PreviewPluginDropDownList.RefreshFromDataSource(); //check if asset uses non-default plugin bool usingCustomPlugin = false; if (Asset.Plugin != Guid.Empty) { Plugin customPlugin = ContextInfo.PluginManager.GetPluginForAsset(Asset); if (customPlugin.RegistrationKey == Asset.Plugin) { PreviewPluginDropDownList.SelectItem(customPlugin.PluginId.GetValueOrDefault(), 0); usingCustomPlugin = true; } } //sets the selected plugin to the default if (!usingCustomPlugin) { PreviewPluginDropDownList.SelectItem(0, -1); } // Initialise the asset thumbnail and preview AssetThumbnail1.Initialise(Asset); AssetPreview1.Asset = Asset; } ConfigurePreviewSettings(); }
protected void SavePreviewSettingsButton_Click(object sender, EventArgs e) { Asset.IsProcessed = ProcessingStatusTrueRadioButton.Checked; //check preview plugin not the default plugin if (PreviewPluginDropDownList.SelectedId > 0) { Asset.Plugin = PluginManager.GetRegistrationKey(PreviewPluginDropDownList.SelectedId); } else { Asset.Plugin = Guid.Empty; } Asset.Update(Asset); //update the display AssetThumbnail1.Initialise(Asset); AssetPreview1.Asset = Asset; ConfigurePreviewSettings(); FeedbackLabel2.SetSuccessMessage("Asset preview settings updated successfully"); }
protected void DeleteThumbnail_Click(object sender, EventArgs e) { AssetThumbnailInfo info = new AssetThumbnailInfo(Asset); if (info.FileExists) { try { File.Delete(info.FilePath); AssetThumbnail1.Initialise(Asset); FeedbackLabel1.SetSuccessMessage("Thumbnail deleted successfully"); } catch (Exception ex) { ExceptionHandler.HandleException(ex, "Error deleting thumbnail"); FeedbackLabel1.SetErrorMessage("Error deleting thumbnail: " + ex.Message); } } else { FeedbackLabel1.SetErrorMessage("Thumbnail file does not exist"); } }
protected void SaveThumbnailButton_Click(object sender, EventArgs e) { BinaryFile file = new BinaryFile(ThumbnailFileUpload.PostedFile); if (file.IsEmpty) { FeedbackLabel1.SetErrorMessage("No file uploaded"); return; } if (!m_AllowedThumbnailExtensions.Contains(file.FileExtension)) { FeedbackLabel1.SetErrorMessage("Invalid file uploaded"); return; } try { // Save the thumbnail AssetFileManager.SaveAssetFile(Asset, file, AssetFileType.AssetThumbnail); // Mark asset as processed Asset.IsProcessed = true; Asset.Update(Asset); // Update thumbnail display AssetThumbnail1.Initialise(Asset); // Update UI FeedbackLabel1.SetSuccessMessage("Thumbnail updated successfully"); } catch (Exception ex) { FeedbackLabel1.SetErrorMessage("Error saving thumbnail: " + ex.Message); ExceptionHandler.HandleException(ex, "Error saving thumbnail"); } }