diff --git a/Directory.Packages.props b/Directory.Packages.props
index d955bc6..991d983 100644
--- a/Directory.Packages.props
+++ b/Directory.Packages.props
@@ -1,10 +1,11 @@
-
- true
-
-
-
-
-
-
+
+ true
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/tests/ScreenGrab.Sample/App.xaml b/tests/ScreenGrab.Sample/App.xaml
index 0520043..b693f4c 100644
--- a/tests/ScreenGrab.Sample/App.xaml
+++ b/tests/ScreenGrab.Sample/App.xaml
@@ -1,9 +1,14 @@
-
+
+
+
+
+
+
diff --git a/tests/ScreenGrab.Sample/App.xaml.cs b/tests/ScreenGrab.Sample/App.xaml.cs
index 356da01..7318aef 100644
--- a/tests/ScreenGrab.Sample/App.xaml.cs
+++ b/tests/ScreenGrab.Sample/App.xaml.cs
@@ -1,12 +1,5 @@
-using System.Configuration;
-using System.Data;
-using System.Windows;
+namespace ScreenGrab.Sample;
-namespace ScreenGrab.Sample;
-
-///
-/// Interaction logic for App.xaml
-///
-public partial class App : Application
+public partial class App
{
}
\ No newline at end of file
diff --git a/tests/ScreenGrab.Sample/MainWindow.xaml b/tests/ScreenGrab.Sample/MainWindow.xaml
index 5629de4..a246fbd 100644
--- a/tests/ScreenGrab.Sample/MainWindow.xaml
+++ b/tests/ScreenGrab.Sample/MainWindow.xaml
@@ -1,20 +1,29 @@
-
+
+
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
-
+
\ No newline at end of file
diff --git a/tests/ScreenGrab.Sample/MainWindow.xaml.cs b/tests/ScreenGrab.Sample/MainWindow.xaml.cs
index ee917a9..a2270d3 100644
--- a/tests/ScreenGrab.Sample/MainWindow.xaml.cs
+++ b/tests/ScreenGrab.Sample/MainWindow.xaml.cs
@@ -1,19 +1,19 @@
using System.Windows;
+using System.Windows.Input;
+using NHotkey;
+using NHotkey.Wpf;
using ScreenGrab.Utilities;
namespace ScreenGrab.Sample;
-///
-/// Interaction logic for MainWindow.xaml
-///
-public partial class MainWindow : Window
+public partial class MainWindow
{
public MainWindow()
{
InitializeComponent();
}
- private void Capture_Click(object sender, RoutedEventArgs e)
+ private void Capture()
{
Clean();
@@ -24,6 +24,16 @@ private void Capture_Click(object sender, RoutedEventArgs e)
grab.Capture();
}
+ private void Capture(object? sender, HotkeyEventArgs e)
+ {
+ Capture();
+ }
+
+ private void Capture_Click(object sender, RoutedEventArgs e)
+ {
+ Capture();
+ }
+
private void Clean_Click(object sender, RoutedEventArgs e)
{
Clean();
@@ -35,4 +45,14 @@ private void Clean()
Img.Source = null;
GC.Collect();
}
+
+ private void MainWindow_OnLoaded(object sender, RoutedEventArgs e)
+ {
+ HotkeyManager.Current.AddOrReplace("Capture", Key.A, ModifierKeys.Windows | ModifierKeys.Shift, Capture);
+ }
+
+ private void MainWindow_OnUnloaded(object sender, RoutedEventArgs e)
+ {
+ HotkeyManager.Current.Remove("Capture");
+ }
}
\ No newline at end of file
diff --git a/tests/ScreenGrab.Sample/ScreenGrab.Sample.csproj b/tests/ScreenGrab.Sample/ScreenGrab.Sample.csproj
index 297edb7..9204b8e 100644
--- a/tests/ScreenGrab.Sample/ScreenGrab.Sample.csproj
+++ b/tests/ScreenGrab.Sample/ScreenGrab.Sample.csproj
@@ -10,4 +10,10 @@
+
+
+
+
+
+