Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Flow.Launcher/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ private async void OnClosing(object sender, CancelEventArgs e)
_viewModel.Save();
e.Cancel = true;
await PluginManager.DisposePluginsAsync();
Application.Current.Shutdown();
Environment.Exit(0);
}

private void OnInitialized(object sender, EventArgs e)
Expand Down Expand Up @@ -185,7 +185,7 @@ private void InitializeNotifyIcon()
var setting = items.Add(InternationalizationManager.Instance.GetTranslation("iconTraySettings"));
setting.Click += (o, e) => App.API.OpenSettingDialog();
var exit = items.Add(InternationalizationManager.Instance.GetTranslation("iconTrayExit"));
exit.Click += (o, e) => Close();
exit.Click += (o, e) => Environment.Exit(0);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For this one, don't change. Calling Close() will allow saving normal process of saving setting.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK. fixed.

Copy link
Contributor Author

@onesounds onesounds Nov 1, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

memo : When executing 'open maintaining folder' on the file plug-in, the problem in which 'lastemptyquery' does not work is also fixed to this pr.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@onesounds should this be Close() not environment.exit acording to @taooceros ?

Copy link
Contributor Author

@onesounds onesounds Nov 6, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes. If I use "environment.ext" here, the process ends immediately, so it don't have time to save settings. If I do as Taoo said, close() will call onclosing(), so it will exit after the save is completed. In short, it is right to use close() here.

This part is not related to this pr topic, just there is a problem that the process continues to remain, so I applied it.


_notifyIcon.ContextMenuStrip = menu;
_notifyIcon.MouseClick += (o, e) =>
Expand Down
39 changes: 18 additions & 21 deletions Flow.Launcher/ViewModel/MainViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -704,33 +704,30 @@ public async void ToggleFlowLauncher()
}
else
{
switch (_settings.LastQueryMode)
{
case LastQueryMode.Empty:
ChangeQueryText(string.Empty);
Application.Current.MainWindow.Opacity = 0; // Trick for no delay
await Task.Delay(100);
Application.Current.MainWindow.Opacity = 1;
break;
case LastQueryMode.Preserved:
LastQuerySelected = true;
break;
case LastQueryMode.Selected:
LastQuerySelected = false;
break;
default:
throw new ArgumentException($"wrong LastQueryMode: <{_settings.LastQueryMode}>");
}
MainWindowVisibility = Visibility.Collapsed;
Hide();
}
}

public void Hide()
public async void Hide()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why add async here? @onesounds / @taooceros

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for handling the task delay for fixing empty query issue.

{
if (MainWindowVisibility != Visibility.Collapsed)
switch (_settings.LastQueryMode)
{
ToggleFlowLauncher();
case LastQueryMode.Empty:
ChangeQueryText(string.Empty);
Application.Current.MainWindow.Opacity = 0; // Trick for no delay
await Task.Delay(100);
Application.Current.MainWindow.Opacity = 1;
break;
case LastQueryMode.Preserved:
LastQuerySelected = true;
break;
case LastQueryMode.Selected:
LastQuerySelected = false;
break;
default:
throw new ArgumentException($"wrong LastQueryMode: <{_settings.LastQueryMode}>");
}
MainWindowVisibility = Visibility.Collapsed;
}

#endregion
Expand Down