WIP memory iconstorage

This commit is contained in:
dan_clark@outlook.com
2022-03-24 20:09:10 +00:00
parent 04df2d2ff6
commit 506161e4b9
14 changed files with 79 additions and 54 deletions
@@ -2,8 +2,5 @@
namespace TheXamlGuy.TaskbarGroup.Flyout.Foundation
{
public record class Drag<TTarget>(DragEventArgs DragEventArgs) where TTarget : UIElement
{
public TTarget Target { get; }
}
public record class Drag<TTarget>(DragEventArgs DragEventArgs) where TTarget : UIElement;
}
@@ -2,8 +2,5 @@
namespace TheXamlGuy.TaskbarGroup.Flyout.Foundation
{
public record class Drop<TTarget>(DragEventArgs DropEventArgs) where TTarget : UIElement
{
public TTarget Target { get; }
}
public record class Drop<TTarget>(DragEventArgs DropEventArgs) where TTarget : UIElement;
}
@@ -1,7 +1,6 @@
using Microsoft.Xaml.Interactivity;
using System;
using TheXamlGuy.TaskbarGroup.Core;
using Windows.ApplicationModel.DataTransfer;
using Windows.UI.Xaml;
namespace TheXamlGuy.TaskbarGroup.Flyout.Foundation
@@ -30,24 +29,19 @@ namespace TheXamlGuy.TaskbarGroup.Flyout.Foundation
base.OnAttached();
}
private object CreateDragMessage(object sender, DragEventArgs args)
protected override void OnDetaching()
{
var dropMessageType = typeof(Drag<>).MakeGenericType(sender.GetType());
return Activator.CreateInstance(dropMessageType, args);
}
AssociatedObject.DragOver -= OnDragOver;
AssociatedObject.Drop -= OnDrop;
private object CreateDropMessage(object sender, DragEventArgs args)
{
var dropMessageType = typeof(Drop<>).MakeGenericType(sender.GetType());
return Activator.CreateInstance(dropMessageType, args);
base.OnDetaching();
}
private void OnDragOver(object sender, DragEventArgs args)
{
if (Mediator is not null)
{
var message = CreateDragMessage(sender, args);
Mediator.HandleAsync(message);
Mediator.Handle(Activator.CreateInstance(typeof(Drag<>).MakeGenericType(sender.GetType()), args));
}
}
@@ -55,8 +49,7 @@ namespace TheXamlGuy.TaskbarGroup.Flyout.Foundation
{
if (Mediator is not null)
{
var message = CreateDropMessage(sender, args);
Mediator.HandleAsync(message);
Mediator.Handle(Activator.CreateInstance(typeof(Drop<>).MakeGenericType(sender.GetType()), args));
}
}
}
@@ -3,7 +3,7 @@ using Windows.UI.Xaml;
namespace TheXamlGuy.TaskbarGroup.Flyout.Foundation
{
public interface IDragHandler<TTarget> : IAsyncMessageHandler<Drag<TTarget>> where TTarget : UIElement
public interface IDragHandler<TTarget> : IMessageHandler<Drag<TTarget>> where TTarget : UIElement
{
}
@@ -3,7 +3,7 @@ using Windows.UI.Xaml;
namespace TheXamlGuy.TaskbarGroup.Flyout.Foundation
{
public interface IDropHandler<TTarget> : IAsyncMessageHandler<Drop<TTarget>> where TTarget : UIElement
public interface IDropHandler<TTarget> : IMessageHandler<Drop<TTarget>> where TTarget : UIElement
{
}
@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Windows.Storage;
namespace TheXamlGuy.TaskbarGroup.Flyout.Foundation
{
public static class IStorageItemExtensions
{
public static async Task<IDictionary<string, object>> RetrievePropertiesAsync(this IStorageItem storageFile, params string[] paramaters)
{
return await (await storageFile.GetBasicPropertiesAsync()).RetrievePropertiesAsync(paramaters);
}
}
}
@@ -130,6 +130,7 @@
<Compile Include="IDragHandler.cs" />
<Compile Include="IDropHandler.cs" />
<Compile Include="IServiceCollectionExtensions.cs" />
<Compile Include="IStorageItemExtensions.cs" />
<Compile Include="IWindowPrivate.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="TemplateSelector.cs" />