mirror of
https://github.com/par274/sharpemu.git
synced 2026-07-18 01:41:36 +00:00
[GUI] Basic hotkey and full-screen support (#75)
This commit is contained in:
@@ -14,7 +14,8 @@ SPDX-License-Identifier: GPL-2.0-or-later
|
|||||||
ExtendClientAreaToDecorationsHint="True"
|
ExtendClientAreaToDecorationsHint="True"
|
||||||
ExtendClientAreaChromeHints="PreferSystemChrome"
|
ExtendClientAreaChromeHints="PreferSystemChrome"
|
||||||
ExtendClientAreaTitleBarHeightHint="44"
|
ExtendClientAreaTitleBarHeightHint="44"
|
||||||
Icon="avares://SharpEmu.GUI/Assets/SharpEmu.ico">
|
Icon="avares://SharpEmu.GUI/Assets/SharpEmu.ico"
|
||||||
|
KeyDown="OnKeyDown">
|
||||||
|
|
||||||
<Grid RowDefinitions="44,*,32">
|
<Grid RowDefinitions="44,*,32">
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ using Avalonia.Input;
|
|||||||
using Avalonia.Interactivity;
|
using Avalonia.Interactivity;
|
||||||
using Avalonia.Media;
|
using Avalonia.Media;
|
||||||
using Avalonia.Media.Imaging;
|
using Avalonia.Media.Imaging;
|
||||||
|
using Avalonia.Platform;
|
||||||
using Avalonia.Platform.Storage;
|
using Avalonia.Platform.Storage;
|
||||||
using Avalonia.Threading;
|
using Avalonia.Threading;
|
||||||
using Avalonia.VisualTree;
|
using Avalonia.VisualTree;
|
||||||
@@ -292,6 +293,34 @@ public partial class MainWindow : Window
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void OnKeyDown(object sender, KeyEventArgs args)
|
||||||
|
{
|
||||||
|
args.Handled = true;
|
||||||
|
switch (args.Key)
|
||||||
|
{
|
||||||
|
case Key.F11:
|
||||||
|
OnWindowFullScreen(this, new RoutedEventArgs());
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
args.Handled = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnWindowFullScreen(object sender, RoutedEventArgs args)
|
||||||
|
{
|
||||||
|
if (WindowState == WindowState.FullScreen)
|
||||||
|
{
|
||||||
|
WindowState = WindowState.Normal;
|
||||||
|
ExtendClientAreaChromeHints = ExtendClientAreaChromeHints.PreferSystemChrome;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
WindowState = WindowState.FullScreen;
|
||||||
|
ExtendClientAreaChromeHints = ExtendClientAreaChromeHints.NoChrome;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void OnWindowClosing()
|
private void OnWindowClosing()
|
||||||
{
|
{
|
||||||
ReadControlsIntoSettings();
|
ReadControlsIntoSettings();
|
||||||
|
|||||||
Reference in New Issue
Block a user