Skip to content

Commit dcc7dbb

Browse files
Merge branch 'dev' into RemoveUnusedNuget
2 parents 306ad79 + 6655d83 commit dcc7dbb

File tree

18 files changed

+113
-101
lines changed

18 files changed

+113
-101
lines changed

Flow.Launcher.Core/Flow.Launcher.Core.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
44
<TargetFramework>net7.0-windows</TargetFramework>
@@ -54,8 +54,8 @@
5454

5555
<ItemGroup>
5656
<PackageReference Include="Droplex" Version="1.6.0" />
57-
<PackageReference Include="FSharp.Core" Version="7.0.0" />
58-
<PackageReference Include="Microsoft.IO.RecyclableMemoryStream" Version="2.3.1" />
57+
<PackageReference Include="FSharp.Core" Version="7.0.300" />
58+
<PackageReference Include="Microsoft.IO.RecyclableMemoryStream" Version="2.3.2" />
5959
<PackageReference Include="squirrel.windows" Version="1.5.2" NoWarn="NU1701" />
6060
</ItemGroup>
6161

Flow.Launcher.Infrastructure/Flow.Launcher.Infrastructure.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
44
<TargetFramework>net7.0-windows</TargetFramework>
@@ -53,7 +53,7 @@
5353
<PrivateAssets>all</PrivateAssets>
5454
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
5555
</PackageReference>
56-
<PackageReference Include="Microsoft.VisualStudio.Threading" Version="17.4.27" />
56+
<PackageReference Include="Microsoft.VisualStudio.Threading" Version="17.5.22" />
5757
<PackageReference Include="NLog" Version="4.7.10" />
5858
<PackageReference Include="NLog.Schema" Version="4.7.10" />
5959
<PackageReference Include="NLog.Web.AspNetCore" Version="4.13.0" />

Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,17 @@ public interface IPublicAPI
8080
/// </summary>
8181
void ShowMainWindow();
8282

83+
/// <summary>
84+
/// Hide MainWindow
85+
/// </summary>
86+
void HideMainWindow();
87+
88+
/// <summary>
89+
/// Representing whether the main window is visible
90+
/// </summary>
91+
/// <returns></returns>
92+
bool IsMainWindowVisible();
93+
8394
/// <summary>
8495
/// Show message box
8596
/// </summary>

Flow.Launcher.Test/Flow.Launcher.Test.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
<PrivateAssets>all</PrivateAssets>
5555
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
5656
</PackageReference>
57-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.1" />
57+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.1" />
5858
</ItemGroup>
5959

6060
</Project>

Flow.Launcher/Flow.Launcher.csproj

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,6 @@
9494
<!-- https://github.com/Flow-Launcher/Flow.Launcher/issues/1772#issuecomment-1502440801 -->
9595
<PackageReference Include="ModernWpfUI" Version="0.9.4" />
9696
<PackageReference Include="NHotkey.Wpf" Version="2.1.0" />
97-
<PackageReference Include="NuGet.CommandLine" Version="6.3.1">
98-
<PrivateAssets>all</PrivateAssets>
99-
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
100-
</PackageReference>
10197
<PackageReference Include="PropertyChanged.Fody" Version="3.4.0" />
10298
<PackageReference Include="SharpVectors" Version="1.8.1" />
10399
<PackageReference Include="VirtualizingWrapPanel" Version="1.5.7" />

Flow.Launcher/MainWindow.xaml.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,16 @@ public MainWindow()
5959

6060
private void OnCopy(object sender, ExecutedRoutedEventArgs e)
6161
{
62-
if (QueryTextBox.SelectionLength == 0)
62+
var result = _viewModel.Results.SelectedItem?.Result;
63+
if (QueryTextBox.SelectionLength == 0 && result != null)
6364
{
64-
_viewModel.ResultCopy(string.Empty);
65+
string copyText = result.CopyText;
66+
_viewModel.ResultCopy(copyText);
6567

6668
}
6769
else if (!string.IsNullOrEmpty(QueryTextBox.Text))
6870
{
69-
_viewModel.ResultCopy(QueryTextBox.SelectedText);
71+
System.Windows.Clipboard.SetText(QueryTextBox.SelectedText);
7072
}
7173
}
7274

Flow.Launcher/PublicAPIInstance.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,10 @@ public void RestartApp()
7373

7474
public void ShowMainWindow() => _mainVM.Show();
7575

76+
public void HideMainWindow() => _mainVM.Hide();
77+
78+
public bool IsMainWindowVisible() => _mainVM.MainWindowVisibilityStatus;
79+
7680
public void CheckForNewUpdate() => _settingsVM.UpdateApp();
7781

7882
public void SaveAppAllSettings()
@@ -114,7 +118,7 @@ public void ShellRun(string cmd, string filename = "cmd.exe")
114118

115119
public void CopyToClipboard(string text)
116120
{
117-
Clipboard.SetDataObject(text);
121+
_mainVM.ResultCopy(text);
118122
}
119123

120124
public void StartLoadingBar() => _mainVM.ProgressBarVisibility = Visibility.Visible;

Flow.Launcher/SettingWindow.xaml.cs

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
using ModernWpf;
1010
using ModernWpf.Controls;
1111
using System;
12+
using System.ComponentModel;
1213
using System.IO;
1314
using System.Windows;
1415
using System.Windows.Data;
@@ -56,12 +57,24 @@ private void OnLoaded(object sender, RoutedEventArgs e)
5657
pluginListView = (CollectionView)CollectionViewSource.GetDefaultView(Plugins.ItemsSource);
5758
pluginListView.Filter = PluginListFilter;
5859

59-
pluginStoreView = (CollectionView)CollectionViewSource.GetDefaultView(StoreListBox.ItemsSource);
60+
pluginStoreView = (CollectionView)CollectionViewSource.GetDefaultView(StoreListBox.ItemsSource);
6061
pluginStoreView.Filter = PluginStoreFilter;
6162

63+
viewModel.PropertyChanged += new PropertyChangedEventHandler(SettingsWindowViewModelChanged);
64+
6265
InitializePosition();
6366
}
6467

68+
private void SettingsWindowViewModelChanged(object sender, PropertyChangedEventArgs e)
69+
{
70+
if (e.PropertyName == nameof(viewModel.ExternalPlugins))
71+
{
72+
pluginStoreView = (CollectionView)CollectionViewSource.GetDefaultView(StoreListBox.ItemsSource);
73+
pluginStoreView.Filter = PluginStoreFilter;
74+
pluginStoreView.Refresh();
75+
}
76+
}
77+
6578
private void OnSelectPythonPathClick(object sender, RoutedEventArgs e)
6679
{
6780
var selectedFile = viewModel.GetFileFromDialog(
@@ -255,9 +268,9 @@ private void ClearLogFolder(object sender, RoutedEventArgs e)
255268
{
256269
var confirmResult = MessageBox.Show(
257270
InternationalizationManager.Instance.GetTranslation("clearlogfolderMessage"),
258-
InternationalizationManager.Instance.GetTranslation("clearlogfolder"),
271+
InternationalizationManager.Instance.GetTranslation("clearlogfolder"),
259272
MessageBoxButton.YesNo);
260-
273+
261274
if (confirmResult == MessageBoxResult.Yes)
262275
{
263276
viewModel.ClearLogFolder();
@@ -388,7 +401,7 @@ private void OnAddCustomShortCutClick(object sender, RoutedEventArgs e)
388401
}
389402

390403
#endregion
391-
404+
392405
private CollectionView pluginListView;
393406
private CollectionView pluginStoreView;
394407

Flow.Launcher/ViewModel/MainViewModel.cs

Lines changed: 25 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1104,47 +1104,39 @@ public void UpdateResultView(IEnumerable<ResultsForUpdate> resultsForUpdates)
11041104
}
11051105

11061106
/// <summary>
1107-
/// This is the global copy method for an individual result. If no text is passed,
1108-
/// the method will work out what is to be copied based on the result, so plugin can offer the text
1109-
/// to be copied via the result model. If the text is a directory/file path,
1110-
/// then actual file/folder will be copied instead.
1111-
/// The result's subtitle text is the default text to be copied
1107+
/// Copies the specified file or folder path to the clipboard, or the specified text if it is not a valid file or folder path.
1108+
/// Shows a message indicating whether the operation was completed successfully.
11121109
/// </summary>
1110+
/// <param name="stringToCopy">The file or folder path, or text to copy to the clipboard.</param>
1111+
/// <returns>Nothing.</returns>
11131112
public void ResultCopy(string stringToCopy)
11141113
{
11151114
if (string.IsNullOrEmpty(stringToCopy))
11161115
{
1117-
var result = Results.SelectedItem?.Result;
1118-
if (result != null)
1119-
{
1120-
string copyText = result.CopyText;
1121-
var isFile = File.Exists(copyText);
1122-
var isFolder = Directory.Exists(copyText);
1123-
if (isFile || isFolder)
1124-
{
1125-
var paths = new StringCollection
1126-
{
1127-
copyText
1128-
};
1129-
1130-
Clipboard.SetFileDropList(paths);
1131-
App.API.ShowMsg(
1132-
$"{App.API.GetTranslation("copy")} {(isFile ? App.API.GetTranslation("fileTitle") : App.API.GetTranslation("folderTitle"))}",
1133-
App.API.GetTranslation("completedSuccessfully"));
1134-
}
1135-
else
1136-
{
1137-
Clipboard.SetDataObject(copyText);
1138-
App.API.ShowMsg(
1139-
$"{App.API.GetTranslation("copy")} {App.API.GetTranslation("textTitle")}",
1140-
App.API.GetTranslation("completedSuccessfully"));
1141-
}
1142-
}
1143-
11441116
return;
11451117
}
1118+
var isFile = File.Exists(stringToCopy);
1119+
var isFolder = Directory.Exists(stringToCopy);
1120+
if (isFile || isFolder)
1121+
{
1122+
var paths = new StringCollection
1123+
{
1124+
stringToCopy
1125+
};
11461126

1147-
Clipboard.SetDataObject(stringToCopy);
1127+
Clipboard.SetFileDropList(paths);
1128+
App.API.ShowMsg(
1129+
$"{App.API.GetTranslation("copy")} {(isFile ? App.API.GetTranslation("fileTitle") : App.API.GetTranslation("folderTitle"))}",
1130+
App.API.GetTranslation("completedSuccessfully"));
1131+
}
1132+
else
1133+
{
1134+
Clipboard.SetDataObject(stringToCopy);
1135+
App.API.ShowMsg(
1136+
$"{App.API.GetTranslation("copy")} {App.API.GetTranslation("textTitle")}",
1137+
App.API.GetTranslation("completedSuccessfully"));
1138+
}
1139+
return;
11481140
}
11491141

11501142
#endregion

Plugins/Flow.Launcher.Plugin.ProcessKiller/Main.cs

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
using System.Collections.Generic;
1+
using System.Collections.Generic;
22
using System.Linq;
33
using Flow.Launcher.Infrastructure;
4-
using System.Threading.Tasks;
54

65
namespace Flow.Launcher.Plugin.ProcessKiller
76
{
@@ -89,7 +88,8 @@ private List<Result> CreateResultsFromQuery(Query query)
8988
Action = (c) =>
9089
{
9190
processHelper.TryKill(p);
92-
_ = DelayAndReQueryAsync(query.RawQuery); // Re-query after killing process to refresh process list
91+
// Re-query to refresh process list
92+
_context.API.ChangeQuery(query.RawQuery, true);
9393
return true;
9494
}
9595
});
@@ -114,19 +114,14 @@ private List<Result> CreateResultsFromQuery(Query query)
114114
{
115115
processHelper.TryKill(p.Process);
116116
}
117-
_ = DelayAndReQueryAsync(query.RawQuery); // Re-query after killing process to refresh process list
117+
// Re-query to refresh process list
118+
_context.API.ChangeQuery(query.RawQuery, true);
118119
return true;
119120
}
120121
});
121122
}
122123

123124
return sortedResults;
124125
}
125-
126-
private static async Task DelayAndReQueryAsync(string query)
127-
{
128-
await Task.Delay(500);
129-
_context.API.ChangeQuery(query, true);
130-
}
131126
}
132127
}

0 commit comments

Comments
 (0)