poe2-bot/src/Poe2Trade.Ui/Overlay/OverlayWindow.axaml.cs
2026-02-18 19:41:05 -05:00

38 lines
920 B
C#

using Avalonia.Controls;
using Poe2Trade.Bot;
namespace Poe2Trade.Ui.Overlay;
public partial class OverlayWindow : Window
{
private readonly BotOrchestrator _bot = null!;
// Designer/XAML loader requires parameterless constructor
public OverlayWindow() => InitializeComponent();
public OverlayWindow(BotOrchestrator bot)
{
_bot = bot;
InitializeComponent();
}
protected override void OnOpened(EventArgs e)
{
base.OnOpened(e);
// Position at top-left corner
Position = new Avalonia.PixelPoint(0, 0);
// Apply Win32 click-through extended styles
if (TryGetPlatformHandle() is { } handle)
OverlayNativeMethods.MakeClickThrough(handle.Handle);
Canvas.Initialize(_bot);
}
protected override void OnClosing(WindowClosingEventArgs e)
{
Canvas.Shutdown();
base.OnClosing(e);
}
}