File tree Expand file tree Collapse file tree 4 files changed +33
-1
lines changed Expand file tree Collapse file tree 4 files changed +33
-1
lines changed Original file line number Diff line number Diff line change @@ -96,7 +96,12 @@ public interface IPublicAPI
96
96
/// </summary>
97
97
/// <returns></returns>
98
98
bool IsMainWindowVisible ( ) ;
99
-
99
+
100
+ /// <summary>
101
+ /// Invoked when the visibility of the main window has changed
102
+ /// </summary>
103
+ event VisibilityChangedEventHandler VisibilityChanged ;
104
+
100
105
/// <summary>
101
106
/// Show message box
102
107
/// </summary>
Original file line number Diff line number Diff line change
1
+ using System ;
2
+
3
+ namespace Flow . Launcher . Plugin
4
+ {
5
+ /// <summary>
6
+ /// A delegate for when the visibility is changed
7
+ /// </summary>
8
+ /// <param name="sender"></param>
9
+ /// <param name="args"></param>
10
+ public delegate void VisibilityChangedEventHandler ( object sender , VisibilityChangedEventArgs args ) ;
11
+ /// <summary>
12
+ /// The event args for <see cref="VisibilityChangedEventHandler"/>
13
+ /// </summary>
14
+ public class VisibilityChangedEventArgs : EventArgs
15
+ {
16
+ /// <summary>
17
+ /// <see langword="true"/> if the main window has become visible
18
+ /// </summary>
19
+ public bool IsVisible { get ; init ; }
20
+ }
21
+ }
Original file line number Diff line number Diff line change @@ -75,6 +75,8 @@ public void RestartApp()
75
75
76
76
public bool IsMainWindowVisible ( ) => _mainVM . MainWindowVisibilityStatus ;
77
77
78
+ public event VisibilityChangedEventHandler VisibilityChanged { add => _mainVM . VisibilityChanged += value ; remove => _mainVM . VisibilityChanged -= value ; }
79
+
78
80
public void CheckForNewUpdate ( ) => _settingsVM . UpdateApp ( ) ;
79
81
80
82
public void SaveAppAllSettings ( )
Original file line number Diff line number Diff line change @@ -578,6 +578,8 @@ private ResultsViewModel SelectedResults
578
578
// because it is more accurate and reliable representation than using Visibility as a condition check
579
579
public bool MainWindowVisibilityStatus { get ; set ; } = true ;
580
580
581
+ public event VisibilityChangedEventHandler VisibilityChanged ;
582
+
581
583
public Visibility SearchIconVisibility { get ; set ; }
582
584
583
585
public double MainWindowWidth
@@ -1014,6 +1016,7 @@ public void Show()
1014
1016
MainWindowOpacity = 1 ;
1015
1017
1016
1018
MainWindowVisibilityStatus = true ;
1019
+ VisibilityChanged ? . Invoke ( this , new VisibilityChangedEventArgs { IsVisible = true } ) ;
1017
1020
} ) ;
1018
1021
}
1019
1022
@@ -1048,6 +1051,7 @@ public async void Hide()
1048
1051
1049
1052
MainWindowVisibilityStatus = false ;
1050
1053
MainWindowVisibility = Visibility . Collapsed ;
1054
+ VisibilityChanged ? . Invoke ( this , new VisibilityChangedEventArgs { IsVisible = false } ) ;
1051
1055
}
1052
1056
1053
1057
/// <summary>
You can’t perform that action at this time.
0 commit comments