diff --git a/Lattice.Example.DragDrop/App.xaml b/Lattice.Example.DragDrop/App.xaml new file mode 100644 index 0000000..758be44 --- /dev/null +++ b/Lattice.Example.DragDrop/App.xaml @@ -0,0 +1,15 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/Lattice.Example.DragDrop/App.xaml.cs b/Lattice.Example.DragDrop/App.xaml.cs new file mode 100644 index 0000000..5177bda --- /dev/null +++ b/Lattice.Example.DragDrop/App.xaml.cs @@ -0,0 +1,33 @@ +using Lattice.Themes; +using Lattice.Themes.Fluent; +using Microsoft.UI.Xaml; + +namespace Lattice.Example.DragDrop; + +public partial class App : Application +{ + private Window? _window; + + public App() + { + InitializeComponent(); + } + + protected override void OnLaunched(LaunchActivatedEventArgs args) + { + // Регистрируем Fluent тему + var themeManager = ThemeManager.Current; + themeManager.RegisterTheme(new FluentThemePack(false)); // Light тема + themeManager.RegisterTheme(new FluentThemePack(true)); // Dark тема + + // Применяем тему по умолчанию + themeManager.ApplyTheme("Fluent"); + + // Создаем главное окно + _window = new MainWindow(); + _window.Activate(); + + // Регистрируем окно в трекере + WindowTracker.Register(_window); + } +} \ No newline at end of file diff --git a/Lattice.Example.DragDrop/Assets/LockScreenLogo.scale-200.png b/Lattice.Example.DragDrop/Assets/LockScreenLogo.scale-200.png new file mode 100644 index 0000000..7440f0d Binary files /dev/null and b/Lattice.Example.DragDrop/Assets/LockScreenLogo.scale-200.png differ diff --git a/Lattice.Example.DragDrop/Assets/SplashScreen.scale-200.png b/Lattice.Example.DragDrop/Assets/SplashScreen.scale-200.png new file mode 100644 index 0000000..32f486a Binary files /dev/null and b/Lattice.Example.DragDrop/Assets/SplashScreen.scale-200.png differ diff --git a/Lattice.Example.DragDrop/Assets/Square150x150Logo.scale-200.png b/Lattice.Example.DragDrop/Assets/Square150x150Logo.scale-200.png new file mode 100644 index 0000000..53ee377 Binary files /dev/null and b/Lattice.Example.DragDrop/Assets/Square150x150Logo.scale-200.png differ diff --git a/Lattice.Example.DragDrop/Assets/Square44x44Logo.scale-200.png b/Lattice.Example.DragDrop/Assets/Square44x44Logo.scale-200.png new file mode 100644 index 0000000..f713bba Binary files /dev/null and b/Lattice.Example.DragDrop/Assets/Square44x44Logo.scale-200.png differ diff --git a/Lattice.Example.DragDrop/Assets/Square44x44Logo.targetsize-24_altform-unplated.png b/Lattice.Example.DragDrop/Assets/Square44x44Logo.targetsize-24_altform-unplated.png new file mode 100644 index 0000000..dc9f5be Binary files /dev/null and b/Lattice.Example.DragDrop/Assets/Square44x44Logo.targetsize-24_altform-unplated.png differ diff --git a/Lattice.Example.DragDrop/Assets/StoreLogo.png b/Lattice.Example.DragDrop/Assets/StoreLogo.png new file mode 100644 index 0000000..a4586f2 Binary files /dev/null and b/Lattice.Example.DragDrop/Assets/StoreLogo.png differ diff --git a/Lattice.Example.DragDrop/Assets/Wide310x150Logo.scale-200.png b/Lattice.Example.DragDrop/Assets/Wide310x150Logo.scale-200.png new file mode 100644 index 0000000..8b4a5d0 Binary files /dev/null and b/Lattice.Example.DragDrop/Assets/Wide310x150Logo.scale-200.png differ diff --git a/Lattice.Example.DragDrop/Handlers/CustomDropHandler.cs b/Lattice.Example.DragDrop/Handlers/CustomDropHandler.cs new file mode 100644 index 0000000..9f2cb3f --- /dev/null +++ b/Lattice.Example.DragDrop/Handlers/CustomDropHandler.cs @@ -0,0 +1,46 @@ +using Lattice.Core.DragDrop.Abstractions; +using Lattice.Core.DragDrop.Models; +using System; +using System.Threading; +using System.Threading.Tasks; + +namespace Lattice.Example.DragDrop; + +public class CustomDropHandler : IDropTarget +{ + private readonly Action _onDrop; + + public CustomDropHandler(Action onDrop) + { + _onDrop = onDrop; + } + + public async Task CanAcceptDropAsync(DropInfo dropInfo, CancellationToken cancellationToken = default) + { + // Принимаем только объекты типа DragDropItem + return dropInfo.Data is DragDropItem; + } + + public async Task OnDragOverAsync(DropInfo dropInfo, CancellationToken cancellationToken = default) + { + if (dropInfo.Data is DragDropItem) + { + dropInfo.SuggestedEffects = Core.DragDrop.Enums.DragDropEffects.Copy; + dropInfo.ShowVisualFeedback = true; + } + } + + public async Task OnDropAsync(DropInfo dropInfo, CancellationToken cancellationToken = default) + { + if (dropInfo.Data is DragDropItem item) + { + _onDrop(item); + dropInfo.MarkAsHandled(); + } + } + + public Task OnDragLeaveAsync(CancellationToken cancellationToken = default) + { + return Task.CompletedTask; + } +} \ No newline at end of file diff --git a/Lattice.Example.DragDrop/Lattice.Example.DragDrop.csproj b/Lattice.Example.DragDrop/Lattice.Example.DragDrop.csproj new file mode 100644 index 0000000..7027f4b --- /dev/null +++ b/Lattice.Example.DragDrop/Lattice.Example.DragDrop.csproj @@ -0,0 +1,67 @@ + + + WinExe + net8.0-windows10.0.19041.0 + 10.0.17763.0 + Lattice.Example.DragDrop + app.manifest + x86;x64;ARM64 + win-x86;win-x64;win-arm64 + win-$(Platform).pubxml + true + false + true + enable + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + + + + + False + True + False + True + + \ No newline at end of file diff --git a/Lattice.Example.DragDrop/MainWindow.xaml b/Lattice.Example.DragDrop/MainWindow.xaml new file mode 100644 index 0000000..edf3b70 --- /dev/null +++ b/Lattice.Example.DragDrop/MainWindow.xaml @@ -0,0 +1,270 @@ + + + + + + + + + + + + + + + + + + + + + + + + +