Files
Hub/Views/MainWindow.axaml.cs
2026-09-19 12:38:12 -03:00

44 lines
1.2 KiB
C#

using Avalonia.Controls;
using Avalonia.Input;
using Avalonia.Interactivity;
namespace NexvaneHub.Views;
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
// The title bar has no native chrome anymore (ExtendClientAreaChromeHints
// = NoChrome), so dragging the window has to be done by hand. Buttons in
// the title bar (settings gear, minimize/maximize/close) consume their
// own PointerPressed before it reaches here, so this only fires for
// clicks on the blank part of the bar.
private void TitleBar_PointerPressed(object? sender, PointerPressedEventArgs e)
{
if (e.GetCurrentPoint(this).Properties.IsLeftButtonPressed)
{
BeginMoveDrag(e);
}
}
private void MinimizeButton_Click(object? sender, RoutedEventArgs e)
{
WindowState = WindowState.Minimized;
}
private void MaximizeButton_Click(object? sender, RoutedEventArgs e)
{
WindowState = WindowState == WindowState.Maximized
? WindowState.Normal
: WindowState.Maximized;
}
private void CloseButton_Click(object? sender, RoutedEventArgs e)
{
Close();
}
}