1
1
using System ;
2
2
using System . Collections . Generic ;
3
3
using System . ComponentModel ;
4
+ using System . Diagnostics ;
4
5
using System . Globalization ;
5
6
using System . Windows . Input ;
6
7
using System . Linq ;
@@ -1437,11 +1438,43 @@ public void Show()
1437
1438
{
1438
1439
// 📌 Remove DWM Cloak (Make the window visible normally)
1439
1440
Win32Helper . DWMSetCloakForWindow ( mainWindow , false ) ;
1441
+
1442
+ //Clock and SearchIcon hide when show situation
1443
+ if ( Settings . UseAnimation )
1444
+ {
1445
+ mainWindow . ClockPanel . Opacity = 0 ;
1446
+ mainWindow . SearchIcon . Opacity = 0 ;
1447
+ }
1448
+ else
1449
+ {
1450
+ mainWindow . ClockPanel . Opacity = 1 ;
1451
+ mainWindow . SearchIcon . Opacity = 1 ;
1452
+ }
1440
1453
1454
+ if ( mainWindow . QueryTextBox . Text . Length != 0 )
1455
+ {
1456
+ mainWindow . ClockPanel . Visibility = Visibility . Collapsed ;
1457
+ }
1458
+ else
1459
+ {
1460
+ mainWindow . ClockPanel . Visibility = Visibility . Visible ;
1461
+ }
1462
+ if ( PluginIconSource != null )
1463
+ {
1464
+ mainWindow . SearchIcon . Opacity = 0 ;
1465
+ }
1466
+ else
1467
+ {
1468
+ SearchIconVisibility = Visibility . Visible ;
1469
+ }
1441
1470
// 📌 Restore UI elements
1442
- mainWindow . ClockPanel . Visibility = Visibility . Visible ;
1443
1471
//mainWindow.SearchIcon.Visibility = Visibility.Visible;
1444
- SearchIconVisibility = Visibility . Visible ;
1472
+ if ( Settings . UseAnimation )
1473
+ {
1474
+ Application . Current . Dispatcher . BeginInvoke ( ( ) =>
1475
+ mainWindow . WindowAnimation ( ) ) ;
1476
+ Debug . WriteLine ( "Call Animation" ) ;
1477
+ }
1445
1478
}
1446
1479
1447
1480
// Update WPF properties
@@ -1474,15 +1507,19 @@ public async void Hide()
1474
1507
}
1475
1508
1476
1509
// 📌 Immediately apply text reset + force UI update
1477
- if ( Settings . LastQueryMode == LastQueryMode . Empty )
1510
+ /* if (Settings.LastQueryMode == LastQueryMode.Empty)
1478
1511
{
1479
1512
ChangeQueryText(string.Empty);
1480
1513
await Task.Delay(1); // Wait for one frame to ensure UI reflects changes
1481
1514
Application.Current.Dispatcher.Invoke(Application.Current.MainWindow.UpdateLayout); // Force UI update
1482
- }
1515
+ }*/
1483
1516
1484
1517
switch ( Settings . LastQueryMode )
1485
1518
{
1519
+ case LastQueryMode . Empty :
1520
+ ChangeQueryText ( string . Empty ) ;
1521
+ await Task . Delay ( 1 ) ;
1522
+ break ;
1486
1523
case LastQueryMode . Preserved :
1487
1524
case LastQueryMode . Selected :
1488
1525
LastQuerySelected = ( Settings . LastQueryMode == LastQueryMode . Preserved ) ;
@@ -1504,18 +1541,26 @@ public async void Hide()
1504
1541
{
1505
1542
// 📌 Set Opacity of icon and clock to 0 and apply Visibility.Hidden
1506
1543
Application . Current . Dispatcher . Invoke ( ( ) =>
1544
+ {
1545
+
1546
+ } , DispatcherPriority . Render ) ;
1547
+ if ( Settings . UseAnimation )
1507
1548
{
1508
1549
mainWindow . ClockPanel . Opacity = 0 ;
1509
1550
mainWindow . SearchIcon . Opacity = 0 ;
1510
- mainWindow . ClockPanel . Visibility = Visibility . Hidden ;
1511
- //mainWindow.SearchIcon.Visibility = Visibility.Hidden;
1512
- SearchIconVisibility = Visibility . Hidden ;
1513
-
1514
- // Force UI update
1515
- mainWindow . ClockPanel . UpdateLayout ( ) ;
1516
- mainWindow . SearchIcon . UpdateLayout ( ) ;
1517
- } , DispatcherPriority . Render ) ;
1551
+ }
1552
+ else
1553
+ {
1554
+ mainWindow . ClockPanel . Opacity = 1 ;
1555
+ mainWindow . SearchIcon . Opacity = 1 ;
1556
+ }
1557
+ mainWindow . ClockPanel . Visibility = Visibility . Hidden ;
1558
+ //mainWindow.SearchIcon.Visibility = Visibility.Hidden;
1559
+ SearchIconVisibility = Visibility . Hidden ;
1518
1560
1561
+ // Force UI update
1562
+ mainWindow . ClockPanel . UpdateLayout ( ) ;
1563
+ mainWindow . SearchIcon . UpdateLayout ( ) ;
1519
1564
// 📌 Apply DWM Cloak (Completely hide the window)
1520
1565
Win32Helper . DWMSetCloakForWindow ( mainWindow , true ) ;
1521
1566
}
0 commit comments