You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
1.0 KiB
41 lines
1.0 KiB
using AsyncAwaitBestPractices; |
|
using Avalonia.Input; |
|
using Avalonia.Interactivity; |
|
using Avalonia.Threading; |
|
using StabilityMatrix.Avalonia.ViewModels.Base; |
|
|
|
namespace StabilityMatrix.Avalonia.Controls; |
|
|
|
public class ImageFolderCard : DropTargetTemplatedControlBase |
|
{ |
|
/// <inheritdoc /> |
|
protected override void OnLoaded(RoutedEventArgs e) |
|
{ |
|
base.OnLoaded(e); |
|
|
|
if (DataContext is ViewModelBase vm) |
|
{ |
|
vm.OnLoaded(); |
|
Dispatcher.UIThread |
|
.InvokeAsync(async () => |
|
{ |
|
await vm.OnLoadedAsync(); |
|
}) |
|
.SafeFireAndForget(); |
|
} |
|
} |
|
|
|
/// <inheritdoc /> |
|
protected override void DropHandler(object? sender, DragEventArgs e) |
|
{ |
|
base.DropHandler(sender, e); |
|
e.Handled = true; |
|
} |
|
|
|
/// <inheritdoc /> |
|
protected override void DragOverHandler(object? sender, DragEventArgs e) |
|
{ |
|
base.DragOverHandler(sender, e); |
|
e.Handled = true; |
|
} |
|
}
|
|
|