Multi-Platform Package Manager for Stable Diffusion
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 lines
1.1 KiB

1 year ago
using Avalonia.Controls;
using Avalonia.Input;
using Avalonia.Interactivity;
using StabilityMatrix.Avalonia.Diagnostics.ViewModels;
namespace StabilityMatrix.Avalonia.Diagnostics.Views;
public partial class LogWindow : Window
{
public LogWindow()
{
InitializeComponent();
}
public static IDisposable Attach(TopLevel root, IServiceProvider serviceProvider)
{
return Attach(root, serviceProvider, new KeyGesture(Key.F11));
}
1 year ago
public static IDisposable Attach(
TopLevel root,
IServiceProvider serviceProvider,
KeyGesture gesture
)
1 year ago
{
return (root ?? throw new ArgumentNullException(nameof(root))).AddDisposableHandler(
KeyDownEvent,
PreviewKeyDown,
1 year ago
RoutingStrategies.Tunnel
);
1 year ago
void PreviewKeyDown(object? sender, KeyEventArgs e)
{
if (gesture.Matches(e))
{
var window = new LogWindow()
{
DataContext = LogWindowViewModel.FromServiceProvider(serviceProvider)
};
window.Show();
}
}
}
}