10
10
using System . Windows ;
11
11
using System . Windows . Input ;
12
12
using System . Windows . Media ;
13
- using System . Windows . Threading ;
14
13
using CommunityToolkit . Mvvm . DependencyInjection ;
15
14
using CommunityToolkit . Mvvm . Input ;
16
15
using Flow . Launcher . Core . Plugin ;
@@ -645,22 +644,22 @@ private async Task ChangeQueryTextAsync(string queryText, bool isReQuery = false
645
644
return ;
646
645
}
647
646
648
- BackToQueryResults ( ) ;
647
+ BackToQueryResults ( ) ;
649
648
650
- if ( QueryText != queryText )
651
- {
652
- // re-query is done in QueryText's setter method
653
- QueryText = queryText ;
654
- // set to false so the subsequent set true triggers
655
- // PropertyChanged and MoveQueryTextToEnd is called
656
- QueryTextCursorMovedToEnd = false ;
657
- }
658
- else if ( isReQuery )
659
- {
660
- await QueryAsync ( isReQuery : true ) ;
661
- }
649
+ if ( QueryText != queryText )
650
+ {
651
+ // re-query is done in QueryText's setter method
652
+ QueryText = queryText ;
653
+ // set to false so the subsequent set true triggers
654
+ // PropertyChanged and MoveQueryTextToEnd is called
655
+ QueryTextCursorMovedToEnd = false ;
656
+ }
657
+ else if ( isReQuery )
658
+ {
659
+ await QueryAsync ( isReQuery : true ) ;
660
+ }
662
661
663
- QueryTextCursorMovedToEnd = true ;
662
+ QueryTextCursorMovedToEnd = true ;
664
663
}
665
664
666
665
public bool LastQuerySelected { get ; set ; }
@@ -1448,43 +1447,10 @@ public bool ShouldIgnoreHotkeys()
1448
1447
1449
1448
#pragma warning disable VSTHRD100 // Avoid async void methods
1450
1449
1451
- public async void Show ( )
1450
+ public void Show ( )
1452
1451
{
1453
- await Application . Current . Dispatcher . InvokeAsync ( ( ) =>
1454
- {
1455
- if ( Application . Current . MainWindow is MainWindow mainWindow )
1456
- {
1457
- // 📌 Remove DWM Cloak (Make the window visible normally)
1458
- Win32Helper . DWMSetCloakForWindow ( mainWindow , false ) ;
1459
-
1460
- // Clock and SearchIcon hide when show situation
1461
- var opacity = Settings . UseAnimation ? 0.0 : 1.0 ;
1462
- mainWindow . ClockPanel . Opacity = opacity ;
1463
- mainWindow . SearchIcon . Opacity = opacity ;
1464
-
1465
- // QueryText sometimes is null when it is just initialized
1466
- if ( QueryText != null && QueryText . Length != 0 )
1467
- {
1468
- mainWindow . ClockPanel . Visibility = Visibility . Collapsed ;
1469
- }
1470
- else
1471
- {
1472
- mainWindow . ClockPanel . Visibility = Visibility . Visible ;
1473
- }
1474
-
1475
- if ( PluginIconSource != null )
1476
- {
1477
- mainWindow . SearchIcon . Opacity = 0 ;
1478
- }
1479
- else
1480
- {
1481
- SearchIconVisibility = Visibility . Visible ;
1482
- }
1483
-
1484
- // 📌 Restore UI elements
1485
- //mainWindow.SearchIcon.Visibility = Visibility.Visible;
1486
- }
1487
- } , DispatcherPriority . Render ) ;
1452
+ // 📌 Remove DWM Cloak (Make the window visible normally)
1453
+ Win32Helper . DWMSetCloakForWindow ( Application . Current . MainWindow , false ) ;
1488
1454
1489
1455
// Update WPF properties
1490
1456
MainWindowVisibility = Visibility . Visible ;
@@ -1500,6 +1466,9 @@ await Application.Current.Dispatcher.InvokeAsync(() =>
1500
1466
1501
1467
public async void Hide ( )
1502
1468
{
1469
+ // 📌 Apply DWM Cloak (Completely hide the window)
1470
+ Win32Helper . DWMSetCloakForWindow ( Application . Current . MainWindow , true ) ;
1471
+
1503
1472
lastHistoryIndex = 1 ;
1504
1473
1505
1474
if ( ExternalPreviewVisible )
@@ -1534,26 +1503,6 @@ public async void Hide()
1534
1503
break ;
1535
1504
}
1536
1505
1537
- await Application . Current . Dispatcher . InvokeAsync ( ( ) =>
1538
- {
1539
- if ( Application . Current . MainWindow is MainWindow mainWindow )
1540
- {
1541
- // 📌 Set Opacity of icon and clock to 0 and apply Visibility.Hidden
1542
- var opacity = Settings . UseAnimation ? 0.0 : 1.0 ;
1543
- mainWindow . ClockPanel . Opacity = opacity ;
1544
- mainWindow . SearchIcon . Opacity = opacity ;
1545
- mainWindow . ClockPanel . Visibility = Visibility . Hidden ;
1546
- SearchIconVisibility = Visibility . Hidden ;
1547
-
1548
- // Force UI update
1549
- mainWindow . ClockPanel . UpdateLayout ( ) ;
1550
- mainWindow . SearchIcon . UpdateLayout ( ) ;
1551
-
1552
- // 📌 Apply DWM Cloak (Completely hide the window)
1553
- Win32Helper . DWMSetCloakForWindow ( mainWindow , true ) ;
1554
- }
1555
- } ) ;
1556
-
1557
1506
if ( StartWithEnglishMode )
1558
1507
{
1559
1508
Win32Helper . RestorePreviousKeyboardLayout ( ) ;
0 commit comments