Skip to content

Commit 5234f2a

Browse files
committed
Fix window not being visible after opening from tray
1 parent 07b56bf commit 5234f2a

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

CompactGUI/ViewModels/MainViewModel.TrayHandler.vb

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,13 @@ Partial Public Class MainViewModel
3434
Private Sub InitialiseNotificationTray()
3535
ClosingCommand = New RelayCommand(Of CancelEventArgs)(AddressOf Closing)
3636
NotifyCommand = New RelayCommand(Sub() Notify("Hello", "World"))
37-
NotifyIconOpenCommand = New RelayCommand(Sub() WindowState = WindowState.Normal)
37+
NotifyIconOpenCommand = New RelayCommand(Sub()
38+
Application.Current.MainWindow.Show()
39+
WindowState = WindowState.Normal
40+
Application.Current.MainWindow.Topmost = True
41+
Application.Current.MainWindow.Activate()
42+
Application.Current.MainWindow.Topmost = False
43+
End Sub)
3844
NotifyIconExitCommand = New RelayCommand(AddressOf NotifyExit)
3945
End Sub
4046

@@ -71,6 +77,7 @@ Partial Public Class MainViewModel
7177
If Watcher.WatchedFolders.Count <> 0 Then
7278
e.Cancel = True
7379
WindowState = WindowState.Minimized
80+
Application.Current.MainWindow.Hide()
7481
End If
7582

7683
End Sub

0 commit comments

Comments
 (0)