Skip to content

Commit

Permalink
Use IStorageItem
Browse files Browse the repository at this point in the history
  • Loading branch information
wieslawsoltes committed May 13, 2023
1 parent 9ef1331 commit c6f0e31
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/Core2D/Behaviors/DragAndDrop/EditorDropHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ private bool Validate(ProjectEditorViewModel editor, object? sender, DragEventAr

if (e.Data.Contains(DataFormats.Files))
{
var files = e.Data.GetFileNames()?.ToArray();
var files = e.Data.GetFiles()?.ToArray();
if (bExecute)
{
if (files is { })
Expand Down
2 changes: 1 addition & 1 deletion src/Core2D/Behaviors/DragAndDrop/PageDropHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ private bool Validate(ProjectEditorViewModel editor, object? sender, DragEventAr

if (e.Data.Contains(DataFormats.Files))
{
var files = e.Data.GetFileNames()?.ToArray();
var files = e.Data.GetFiles()?.ToArray();
if (bExecute)
{
editor?.OnDropFiles(files, point.X, point.Y);
Expand Down
6 changes: 4 additions & 2 deletions src/Core2D/ViewModels/Editor/ProjectEditorViewModel.Editor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using System.Reactive.Disposables;
using System.Reactive.Subjects;
using System.Threading.Tasks;
using Avalonia.Platform.Storage;
using Core2D.Model;
using Core2D.Model.Editor;
using Core2D.Model.Renderer;
Expand Down Expand Up @@ -888,7 +889,7 @@ public void OnRedo()
}
}

public async Task<bool> OnDropFiles(string[]? files, double x, double y)
public async Task<bool> OnDropFiles(IStorageItem[]? files, double x, double y)
{
try
{
Expand All @@ -899,8 +900,9 @@ public async Task<bool> OnDropFiles(string[]? files, double x, double y)

var result = false;

foreach (var path in files)
foreach (var file in files)
{
var path = file.TryGetLocalPath();
if (string.IsNullOrEmpty(path))
{
continue;
Expand Down

0 comments on commit c6f0e31

Please sign in to comment.