38 lines
920 B
C#
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);
|
|
}
|
|
}
|