Skip to content

Commit 1b4aa19

Browse files
committed
Pull
2 parents 07b42ff + 67c9004 commit 1b4aa19

File tree

3 files changed

+24
-26
lines changed

3 files changed

+24
-26
lines changed

Flow.Launcher.Infrastructure/UserSettings/Settings.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using System.Text.Json.Serialization;
66
using Flow.Launcher.Plugin;
77
using Flow.Launcher.Plugin.SharedModels;
8+
using Flow.Launcher;
89
using Flow.Launcher.ViewModel;
910

1011
namespace Flow.Launcher.Infrastructure.UserSettings
@@ -41,7 +42,7 @@ public string Language
4142
public int CustomExplorerIndex { get; set; } = 0;
4243
public CustomExplorerViewModel CustomExplorer
4344
{
44-
get => CustomExplorerList[CustomExplorerIndex];
45+
get => CustomExplorerList[CustomExplorerIndex < CustomExplorerList.Count ? CustomExplorerIndex : 0];
4546
set => CustomExplorerList[CustomExplorerIndex] = value;
4647
}
4748

Flow.Launcher/MainWindow.xaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ private async void OnClosing(object sender, CancelEventArgs e)
5656
_viewModel.Save();
5757
e.Cancel = true;
5858
await PluginManager.DisposePluginsAsync();
59-
Application.Current.Shutdown();
59+
Environment.Exit(0);
6060
}
6161

6262
private void OnInitialized(object sender, EventArgs e)

Flow.Launcher/ViewModel/MainViewModel.cs

Lines changed: 21 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ private void InitializeKeyCommands()
281281
ReloadPluginDataCommand = new RelayCommand(_ =>
282282
{
283283
Hide();
284-
284+
285285
PluginManager
286286
.ReloadData()
287287
.ContinueWith(_ =>
@@ -323,7 +323,7 @@ public string QueryText
323323
/// <param name="queryText"></param>
324324
public void ChangeQueryText(string queryText, bool reQuery = false)
325325
{
326-
if (QueryText!=queryText)
326+
if (QueryText != queryText)
327327
{
328328
// re-query is done in QueryText's setter method
329329
QueryText = queryText;
@@ -706,41 +706,38 @@ private void SetOpenResultModifiers()
706706
OpenResultCommandModifiers = _settings.OpenResultModifiers ?? DefaultOpenResultModifiers;
707707
}
708708

709-
public async void ToggleFlowLauncher()
709+
public void ToggleFlowLauncher()
710710
{
711711
if (MainWindowVisibility != Visibility.Visible)
712712
{
713713
MainWindowVisibility = Visibility.Visible;
714714
}
715715
else
716716
{
717-
switch (_settings.LastQueryMode)
718-
{
719-
case LastQueryMode.Empty:
720-
ChangeQueryText(string.Empty);
721-
Application.Current.MainWindow.Opacity = 0; // Trick for no delay
722-
await Task.Delay(100);
723-
Application.Current.MainWindow.Opacity = 1;
724-
break;
725-
case LastQueryMode.Preserved:
726-
LastQuerySelected = true;
727-
break;
728-
case LastQueryMode.Selected:
729-
LastQuerySelected = false;
730-
break;
731-
default:
732-
throw new ArgumentException($"wrong LastQueryMode: <{_settings.LastQueryMode}>");
733-
}
734-
MainWindowVisibility = Visibility.Collapsed;
717+
Hide();
735718
}
736719
}
737720

738-
public void Hide()
721+
public async void Hide()
739722
{
740-
if (MainWindowVisibility != Visibility.Collapsed)
723+
switch (_settings.LastQueryMode)
741724
{
742-
ToggleFlowLauncher();
725+
case LastQueryMode.Empty:
726+
ChangeQueryText(string.Empty);
727+
Application.Current.MainWindow.Opacity = 0; // Trick for no delay
728+
await Task.Delay(100);
729+
Application.Current.MainWindow.Opacity = 1;
730+
break;
731+
case LastQueryMode.Preserved:
732+
LastQuerySelected = true;
733+
break;
734+
case LastQueryMode.Selected:
735+
LastQuerySelected = false;
736+
break;
737+
default:
738+
throw new ArgumentException($"wrong LastQueryMode: <{_settings.LastQueryMode}>");
743739
}
740+
MainWindowVisibility = Visibility.Collapsed;
744741
}
745742

746743
#endregion

0 commit comments

Comments
 (0)