From 57a9c13a9f13218bc2f1575c829a607cb3e0c005 Mon Sep 17 00:00:00 2001 From: Simon G Date: Wed, 7 Apr 2021 14:08:04 +0200 Subject: [PATCH] - add handling to hide main window instead of closing it --- Mystify/Views/MainWindow.axaml.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Mystify/Views/MainWindow.axaml.cs b/Mystify/Views/MainWindow.axaml.cs index aaa4006..40556ef 100644 --- a/Mystify/Views/MainWindow.axaml.cs +++ b/Mystify/Views/MainWindow.axaml.cs @@ -1,3 +1,4 @@ +using System.ComponentModel; using Avalonia; using Avalonia.Controls; using Avalonia.Markup.Xaml; @@ -9,11 +10,21 @@ namespace Mystify.Views public MainWindow() { InitializeComponent(); + + Closing += OnClosing; + #if DEBUG this.AttachDevTools(); #endif } private void InitializeComponent() => AvaloniaXamlLoader.Load(this); + + private void OnClosing(object? sender, CancelEventArgs args) + { + //don't really close main window, just hide it -> notify icon is still there + Hide(); + args.Cancel = true; + } } } \ No newline at end of file