Skip to content

Commit c26a07e

Browse files
Merge pull request #27 from nullinside-development-group/feat/hide
feat: hide window on appliation start
2 parents a8a4c51 + f1dbc72 commit c26a07e

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

src/SiteMonitor/Views/MainWindow.axaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
ShowInTaskbar="{Binding !IsMinimized, Mode=TwoWay}"
1414
Topmost="True"
1515
WindowStartupLocation="CenterScreen"
16+
Loaded="HideWindowOnLoaded"
1617
x:Class="SiteMonitor.Views.MainWindow"
1718
x:DataType="viewModels:MainWindowViewModel"
1819
Icon="/Assets/logo.ico"

src/SiteMonitor/Views/MainWindow.axaml.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using System.Threading.Tasks;
44

55
using Avalonia.Controls;
6+
using Avalonia.Interactivity;
67

78
using Nullinside.Api.Common.Desktop;
89
#if !DEBUG
@@ -92,4 +93,9 @@ protected override void OnInitialized() {
9293
#endif
9394
});
9495
}
96+
97+
private void HideWindowOnLoaded(object? sender, RoutedEventArgs e) {
98+
var window = (Window)sender!;
99+
window.WindowState = WindowState.Minimized;
100+
}
95101
}

0 commit comments

Comments
 (0)