Skip to content

Commit 9741156

Browse files
committed
Improve code quality
1 parent f7954a0 commit 9741156

File tree

1 file changed

+23
-22
lines changed

1 file changed

+23
-22
lines changed

Flow.Launcher/ViewModel/MainViewModel.cs

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ public partial class MainViewModel : BaseModel, ISavable
4949
private ChannelWriter<ResultsForUpdate> _resultsUpdateChannelWriter;
5050
private Task _resultsViewUpdateTask;
5151

52+
private readonly IReadOnlyList<Result> _emptyResult = new List<Result>();
53+
5254
#endregion
5355

5456
#region Constructor
@@ -830,16 +832,18 @@ private static string VerifyOrSetDefaultHotkey(string hotkey, string defaultHotk
830832

831833
#region Preview
832834

833-
private bool? _selectedItemFromQueryResults;
835+
private static readonly int ResultAreaColumnPreviewShown = 1;
836+
private static readonly int ResultAreaColumnPreviewHidden = 3;
834837

835-
private ResultViewModel _selectedItem;
838+
private bool? _selectedItemFromQueryResults;
836839

840+
private ResultViewModel _previewSelectedItem;
837841
public ResultViewModel PreviewSelectedItem
838842
{
839-
get => _selectedItem;
843+
get => _previewSelectedItem;
840844
set
841845
{
842-
_selectedItem = value;
846+
_previewSelectedItem = value;
843847
OnPropertyChanged();
844848
}
845849
}
@@ -862,10 +866,6 @@ public bool InternalPreviewVisible
862866
}
863867
}
864868

865-
private static readonly int ResultAreaColumnPreviewShown = 1;
866-
867-
private static readonly int ResultAreaColumnPreviewHidden = 3;
868-
869869
public int ResultAreaColumn { get; set; } = ResultAreaColumnPreviewShown;
870870

871871
// This is not a reliable indicator of whether external preview is visible due to the
@@ -1016,7 +1016,7 @@ private bool QueryResultsPreviewed()
10161016

10171017
#region Query
10181018

1019-
public void Query(bool isReQuery = false)
1019+
private void Query(bool isReQuery = false)
10201020
{
10211021
if (QueryResultsSelected())
10221022
{
@@ -1121,8 +1121,6 @@ private void QueryHistory()
11211121
}
11221122
}
11231123

1124-
private readonly IReadOnlyList<Result> _emptyResult = new List<Result>();
1125-
11261124
private async Task QueryResultsAsync(bool isReQuery = false, bool reSelect = true)
11271125
{
11281126
_updateSource?.Cancel();
@@ -1420,6 +1418,18 @@ public void ToggleFlowLauncher()
14201418
}
14211419
}
14221420

1421+
/// <summary>
1422+
/// Checks if Flow Launcher should ignore any hotkeys
1423+
/// </summary>
1424+
public bool ShouldIgnoreHotkeys()
1425+
{
1426+
return Settings.IgnoreHotkeysOnFullscreen && Win32Helper.IsForegroundWindowFullscreen() || GameModeStatus;
1427+
}
1428+
1429+
#endregion
1430+
1431+
#region Public Methods
1432+
14231433
public void Show()
14241434
{
14251435
Application.Current.Dispatcher.Invoke(() =>
@@ -1505,7 +1515,7 @@ public async void Hide()
15051515
// 📌 Apply DWM Cloak (Completely hide the window)
15061516
Win32Helper.DWMSetCloakForWindow(mainWindow, true);
15071517
}
1508-
1518+
15091519
await Task.Delay(50);
15101520

15111521
// Update WPF properties
@@ -1518,17 +1528,8 @@ public async void Hide()
15181528
#pragma warning restore VSTHRD100 // Avoid async void methods
15191529

15201530
/// <summary>
1521-
/// Checks if Flow Launcher should ignore any hotkeys
1531+
/// Save history, user selected records and top most records
15221532
/// </summary>
1523-
public bool ShouldIgnoreHotkeys()
1524-
{
1525-
return Settings.IgnoreHotkeysOnFullscreen && Win32Helper.IsForegroundWindowFullscreen() || GameModeStatus;
1526-
}
1527-
1528-
#endregion
1529-
1530-
#region Public Methods
1531-
15321533
public void Save()
15331534
{
15341535
_historyItemsStorage.Save();

0 commit comments

Comments
 (0)