@@ -240,6 +240,19 @@ private void RegisterResultsUpdatedEvent()
240
240
}
241
241
}
242
242
243
+ private async Task RegisterClockAndDateUpdateAsync ( )
244
+ {
245
+ var timer = new PeriodicTimer ( TimeSpan . FromSeconds ( 1 ) ) ;
246
+ // ReSharper disable once MethodSupportsCancellation
247
+ while ( await timer . WaitForNextTickAsync ( ) . ConfigureAwait ( false ) )
248
+ {
249
+ if ( Settings . UseClock )
250
+ ClockText = DateTime . Now . ToString ( Settings . TimeFormat , CultureInfo . CurrentCulture ) ;
251
+ if ( Settings . UseDate )
252
+ DateText = DateTime . Now . ToString ( Settings . DateFormat , CultureInfo . CurrentCulture ) ;
253
+ }
254
+ }
255
+
243
256
[ RelayCommand ]
244
257
private async Task ReloadPluginDataAsync ( )
245
258
{
@@ -284,7 +297,7 @@ public void ReverseHistory()
284
297
{
285
298
if ( _history . Items . Count > 0 )
286
299
{
287
- ChangeQueryText ( _history . Items [ _history . Items . Count - lastHistoryIndex ] . Query . ToString ( ) ) ;
300
+ ChangeQueryText ( _history . Items [ ^ lastHistoryIndex ] . Query . ToString ( ) ) ;
288
301
if ( lastHistoryIndex < _history . Items . Count )
289
302
{
290
303
lastHistoryIndex ++ ;
@@ -297,7 +310,7 @@ public void ForwardHistory()
297
310
{
298
311
if ( _history . Items . Count > 0 )
299
312
{
300
- ChangeQueryText ( _history . Items [ _history . Items . Count - lastHistoryIndex ] . Query . ToString ( ) ) ;
313
+ ChangeQueryText ( _history . Items [ ^ lastHistoryIndex ] . Query . ToString ( ) ) ;
301
314
if ( lastHistoryIndex > 1 )
302
315
{
303
316
lastHistoryIndex -- ;
@@ -348,12 +361,12 @@ private void AutocompleteQuery()
348
361
}
349
362
else if ( ! string . IsNullOrEmpty ( SelectedResults . SelectedItem ? . QuerySuggestionText ) )
350
363
{
351
- var defaultSuggestion = SelectedResults . SelectedItem . QuerySuggestionText ;
352
- // check if result.actionkeywordassigned is empty
353
- if ( ! string . IsNullOrEmpty ( result . ActionKeywordAssigned ) )
354
- {
355
- autoCompleteText = $ "{ result . ActionKeywordAssigned } { defaultSuggestion } ";
356
- }
364
+ // var defaultSuggestion = SelectedResults.SelectedItem.QuerySuggestionText;
365
+ //// check if result.actionkeywordassigned is empty
366
+ // if (!string.IsNullOrEmpty(result.ActionKeywordAssigned))
367
+ // {
368
+ // autoCompleteText = $"{result.ActionKeywordAssigned} {defaultSuggestion}";
369
+ // }
357
370
358
371
autoCompleteText = SelectedResults . SelectedItem . QuerySuggestionText ;
359
372
}
@@ -532,19 +545,6 @@ public void CopyAlternative()
532
545
public string ClockText { get ; private set ; }
533
546
public string DateText { get ; private set ; }
534
547
535
- private async Task RegisterClockAndDateUpdateAsync ( )
536
- {
537
- var timer = new PeriodicTimer ( TimeSpan . FromSeconds ( 1 ) ) ;
538
- // ReSharper disable once MethodSupportsCancellation
539
- while ( await timer . WaitForNextTickAsync ( ) . ConfigureAwait ( false ) )
540
- {
541
- if ( Settings . UseClock )
542
- ClockText = DateTime . Now . ToString ( Settings . TimeFormat , CultureInfo . CurrentCulture ) ;
543
- if ( Settings . UseDate )
544
- DateText = DateTime . Now . ToString ( Settings . DateFormat , CultureInfo . CurrentCulture ) ;
545
- }
546
- }
547
-
548
548
public ResultsViewModel Results { get ; private set ; }
549
549
550
550
public ResultsViewModel ContextMenu { get ; private set ; }
@@ -751,7 +751,7 @@ public double ResultSubItemFontSize
751
751
752
752
public string OpenResultCommandModifiers => Settings . OpenResultModifiers ;
753
753
754
- public string VerifyOrSetDefaultHotkey ( string hotkey , string defaultHotkey )
754
+ private static string VerifyOrSetDefaultHotkey ( string hotkey , string defaultHotkey )
755
755
{
756
756
try
757
757
{
@@ -780,8 +780,6 @@ public string VerifyOrSetDefaultHotkey(string hotkey, string defaultHotkey)
780
780
public string CycleHistoryUpHotkey => VerifyOrSetDefaultHotkey ( Settings . CycleHistoryUpHotkey , "Alt+Up" ) ;
781
781
public string CycleHistoryDownHotkey => VerifyOrSetDefaultHotkey ( Settings . CycleHistoryDownHotkey , "Alt+Down" ) ;
782
782
783
- public string Image => Constant . QueryTextBoxIconImagePath ;
784
-
785
783
public bool StartWithEnglishMode => Settings . AlwaysStartEn ;
786
784
787
785
#endregion
@@ -866,18 +864,6 @@ private void TogglePreview()
866
864
}
867
865
}
868
866
869
- private void ToggleInternalPreview ( )
870
- {
871
- if ( ! InternalPreviewVisible )
872
- {
873
- ShowInternalPreview ( ) ;
874
- }
875
- else
876
- {
877
- HideInternalPreview ( ) ;
878
- }
879
- }
880
-
881
867
private void OpenExternalPreview ( string path , bool sendFailToast = true )
882
868
{
883
869
_ = PluginManager . OpenExternalPreviewAsync ( path , sendFailToast ) . ConfigureAwait ( false ) ;
@@ -1368,27 +1354,27 @@ public void ToggleFlowLauncher()
1368
1354
}
1369
1355
1370
1356
public void Show ( )
1371
- {
1372
- Application . Current . Dispatcher . Invoke ( ( ) =>
1373
- {
1374
- if ( Application . Current . MainWindow is MainWindow mainWindow )
1375
1357
{
1376
- // 📌 Remove DWM Cloak (Make the window visible normally)
1377
- Win32Helper . DWMSetCloakForWindow ( mainWindow , false ) ;
1358
+ Application . Current . Dispatcher . Invoke ( ( ) =>
1359
+ {
1360
+ if ( Application . Current . MainWindow is MainWindow mainWindow )
1361
+ {
1362
+ // 📌 Remove DWM Cloak (Make the window visible normally)
1363
+ Win32Helper . DWMSetCloakForWindow ( mainWindow , false ) ;
1378
1364
1379
- // 📌 Restore UI elements
1380
- mainWindow . ClockPanel . Visibility = Visibility . Visible ;
1381
- //mainWindow.SearchIcon.Visibility = Visibility.Visible;
1382
- SearchIconVisibility = Visibility . Visible ;
1383
- }
1365
+ // 📌 Restore UI elements
1366
+ mainWindow . ClockPanel . Visibility = Visibility . Visible ;
1367
+ //mainWindow.SearchIcon.Visibility = Visibility.Visible;
1368
+ SearchIconVisibility = Visibility . Visible ;
1369
+ }
1384
1370
1385
- // Update WPF properties
1386
- MainWindowVisibility = Visibility . Visible ;
1387
- MainWindowOpacity = 1 ;
1388
- MainWindowVisibilityStatus = true ;
1389
- VisibilityChanged ? . Invoke ( this , new VisibilityChangedEventArgs { IsVisible = true } ) ;
1390
- } ) ;
1391
- }
1371
+ // Update WPF properties
1372
+ MainWindowVisibility = Visibility . Visible ;
1373
+ MainWindowOpacity = 1 ;
1374
+ MainWindowVisibilityStatus = true ;
1375
+ VisibilityChanged ? . Invoke ( this , new VisibilityChangedEventArgs { IsVisible = true } ) ;
1376
+ } ) ;
1377
+ }
1392
1378
1393
1379
#pragma warning disable VSTHRD100 // Avoid async void methods
1394
1380
@@ -1456,15 +1442,15 @@ public async void Hide()
1456
1442
Win32Helper . DWMSetCloakForWindow ( mainWindow , true ) ;
1457
1443
}
1458
1444
1459
- await Task . Delay ( 50 ) ;
1445
+ await Task . Delay ( 50 ) ;
1446
+
1460
1447
// Update WPF properties
1461
1448
//MainWindowOpacity = 0;
1462
1449
MainWindowVisibilityStatus = false ;
1463
1450
MainWindowVisibility = Visibility . Collapsed ;
1464
1451
VisibilityChanged ? . Invoke ( this , new VisibilityChangedEventArgs { IsVisible = false } ) ;
1465
1452
}
1466
1453
1467
-
1468
1454
#pragma warning restore VSTHRD100 // Avoid async void methods
1469
1455
1470
1456
/// <summary>
0 commit comments