Skip to content

Commit

Permalink
Small fix for file names when pasting images
Browse files Browse the repository at this point in the history
  • Loading branch information
d2dyno1 committed Dec 22, 2021
1 parent f48df82 commit b1f5855
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
8 changes: 7 additions & 1 deletion ClipboardCanvas/CanavsPasteModels/ImagePasteModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
using ClipboardCanvas.Contexts.Operations;
using ClipboardCanvas.Helpers;
using ClipboardCanvas.Helpers.Filesystem;
using System.IO;

namespace ClipboardCanvas.CanavsPasteModels
{
Expand Down Expand Up @@ -90,8 +91,13 @@ protected override async Task<SafeWrapperResult> SetDataFromDataPackage(DataPack
}
else // Just image
{

SafeWrapper<RandomAccessStreamReference> bitmap = await dataPackage.SafeGetBitmapAsync();
SafeWrapper<Uri> uri = await dataPackage.SafeGetUriAsync();

if (uri)
{
customName = Path.GetFileName(uri.Result.LocalPath);
}

if (!bitmap)
{
Expand Down
5 changes: 5 additions & 0 deletions ClipboardCanvas/Helpers/ClipboardHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,10 @@ public static async Task<SafeWrapper<RandomAccessStreamReference>> SafeGetBitmap
{
return await SafeWrapperRoutines.SafeWrapAsync(() => dataPackage.GetBitmapAsync().AsTask());
}

public static async Task<SafeWrapper<Uri>> SafeGetUriAsync(this DataPackageView dataPackage)
{
return await SafeWrapperRoutines.SafeWrapAsync(() => dataPackage.GetUriAsync().AsTask());
}
}
}
2 changes: 1 addition & 1 deletion ClipboardCanvas/Package.appxmanifest
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
EntryPoint="$targetentrypoint$">
<uap:VisualElements
DisplayName="Clipboard Canvas"
Description="A tool that helps you be productive, preview multiple files on Infinite Canvas, save storage space with smart Reference Files, and work uninterruptedly with AutoPaste."
Description="A tool that helps you be productive, preview multiple files on Infinite Canvas, save storage space with smart Reference Files, and work uninterruptedly with Autopaste."
BackgroundColor="transparent"
Square150x150Logo="Assets\AppIcon\Square150x150Logo.png"
Square44x44Logo="Assets\AppIcon\Square44x44Logo.png">
Expand Down

0 comments on commit b1f5855

Please sign in to comment.