Skip to content

Commit 505bbb9

Browse files
committed
Rename setting and reset cache when results are chosen
1 parent caf0f58 commit 505bbb9

File tree

6 files changed

+120
-139
lines changed

6 files changed

+120
-139
lines changed

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,10 +147,15 @@ public static async Task IndexPrograms()
147147
var t1 = Task.Run(IndexWin32Programs);
148148
var t2 = Task.Run(IndexUwpPrograms);
149149
await Task.WhenAll(t1, t2).ConfigureAwait(false);
150+
ResetCache();
151+
_settings.LastIndexTime = DateTime.Today;
152+
}
153+
154+
internal static void ResetCache()
155+
{
150156
var oldCache = cache;
151157
cache = new MemoryCache(cacheOptions);
152158
oldCache.Dispose();
153-
_settings.LastIndexTime = DateTime.Today;
154159
}
155160

156161
public Control CreateSettingPanel()

Plugins/Flow.Launcher.Plugin.Program/Programs/UWP.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ public Result Result(string query, IPublicAPI api)
314314
var result = new Result
315315
{
316316
Title = title,
317-
SubTitle = Main._settings.EnableHideAppsPath ? string.Empty : Package.Location,
317+
SubTitle = Main._settings.HideAppsPath ? string.Empty : Package.Location,
318318
Icon = Logo,
319319
Score = matchResult.Score,
320320
TitleHighlightData = matchResult.MatchData,

Plugins/Flow.Launcher.Plugin.Program/Programs/Win32.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public Result Result(string query, IPublicAPI api)
9797
var result = new Result
9898
{
9999
Title = title,
100-
SubTitle = Main._settings.EnableHideAppsPath ? string.Empty : LnkResolvedPath ?? FullPath,
100+
SubTitle = Main._settings.HideAppsPath ? string.Empty : LnkResolvedPath ?? FullPath,
101101
IcoPath = IcoPath,
102102
Score = matchResult.Score,
103103
TitleHighlightData = matchResult.MatchData,

Plugins/Flow.Launcher.Plugin.Program/Settings.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public class Settings
1414
public bool EnableStartMenuSource { get; set; } = true;
1515

1616
public bool EnableDescription { get; set; } = false;
17-
public bool EnableHideAppsPath { get; set; } = true;
17+
public bool HideAppsPath { get; set; } = true;
1818
public bool EnableRegistrySource { get; set; } = true;
1919
public string CustomizedExplorer { get; set; } = Explorer;
2020
public string CustomizedArgs { get; set; } = ExplorerArgs;

Plugins/Flow.Launcher.Plugin.Program/Views/ProgramSetting.xaml

Lines changed: 99 additions & 130 deletions
Original file line numberDiff line numberDiff line change
@@ -1,123 +1,101 @@
1-
<UserControl
2-
x:Class="Flow.Launcher.Plugin.Program.Views.ProgramSetting"
3-
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
4-
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
5-
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
6-
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
7-
xmlns:program="clr-namespace:Flow.Launcher.Plugin.Program"
8-
Height="520"
9-
DataContext="{Binding RelativeSource={RelativeSource Self}}"
10-
mc:Ignorable="d">
1+
<UserControl x:Class="Flow.Launcher.Plugin.Program.Views.ProgramSetting"
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
5+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
6+
xmlns:program="clr-namespace:Flow.Launcher.Plugin.Program"
7+
Height="520"
8+
DataContext="{Binding RelativeSource={RelativeSource Self}}"
9+
mc:Ignorable="d">
1110
<Grid Margin="0">
1211
<Grid.RowDefinitions>
1312
<RowDefinition Height="170" />
1413
<RowDefinition Height="*" />
1514
<RowDefinition Height="60" />
1615
</Grid.RowDefinitions>
17-
<StackPanel
18-
Grid.Row="0"
19-
HorizontalAlignment="Stretch"
20-
Orientation="Vertical">
16+
<StackPanel Grid.Row="0" HorizontalAlignment="Stretch" Orientation="Vertical">
2117
<StackPanel Width="Auto" Orientation="Vertical">
2218
<StackPanel Width="Auto" Orientation="Horizontal">
23-
<CheckBox
24-
Name="StartMenuEnabled"
25-
Width="200"
26-
Margin="70,8,10,8"
27-
Content="{DynamicResource flowlauncher_plugin_program_index_start}"
28-
IsChecked="{Binding EnableStartMenuSource}"
29-
ToolTip="{DynamicResource flowlauncher_plugin_program_index_start_tooltip}" />
30-
<CheckBox
31-
Name="RegistryEnabled"
32-
Margin="70,8,10,8"
33-
Content="{DynamicResource flowlauncher_plugin_program_index_registry}"
34-
IsChecked="{Binding EnableRegistrySource}"
35-
ToolTip="{DynamicResource flowlauncher_plugin_program_index_registry_tooltip}" />
19+
<CheckBox Name="StartMenuEnabled"
20+
Width="200"
21+
Margin="70,8,10,8"
22+
Content="{DynamicResource flowlauncher_plugin_program_index_start}"
23+
IsChecked="{Binding EnableStartMenuSource}"
24+
ToolTip="{DynamicResource flowlauncher_plugin_program_index_start_tooltip}" />
25+
<CheckBox Name="RegistryEnabled"
26+
Margin="70,8,10,8"
27+
Content="{DynamicResource flowlauncher_plugin_program_index_registry}"
28+
IsChecked="{Binding EnableRegistrySource}"
29+
ToolTip="{DynamicResource flowlauncher_plugin_program_index_registry_tooltip}" />
3630
</StackPanel>
3731

38-
<Separator
39-
Height="1"
40-
BorderBrush="{DynamicResource Color03B}"
41-
BorderThickness="1" />
32+
<Separator Height="1" BorderBrush="{DynamicResource Color03B}" BorderThickness="1" />
4233
<StackPanel Width="Auto" Orientation="Horizontal">
43-
<CheckBox
44-
Name="HideLnkEnabled"
45-
Width="200"
46-
Margin="70,8,10,8"
47-
Content="{DynamicResource flowlauncher_plugin_program_enable_hidelnkpath}"
48-
IsChecked="{Binding EnableHideAppsPath}"
49-
ToolTip="{DynamicResource flowlauncher_plugin_program_enable_hidelnkpath_tooltip}" />
50-
<CheckBox
51-
Name="DescriptionEnabled"
52-
Margin="70,8,10,8"
53-
Content="{DynamicResource flowlauncher_plugin_program_enable_description}"
54-
IsChecked="{Binding EnableDescription}"
55-
ToolTip="{DynamicResource flowlauncher_plugin_program_enable_description_tooltip}" />
34+
<CheckBox Name="HideLnkEnabled"
35+
Width="200"
36+
Margin="70,8,10,8"
37+
Content="{DynamicResource flowlauncher_plugin_program_enable_hidelnkpath}"
38+
IsChecked="{Binding HideAppsPath}"
39+
ToolTip="{DynamicResource flowlauncher_plugin_program_enable_hidelnkpath_tooltip}" />
40+
<CheckBox Name="DescriptionEnabled"
41+
Margin="70,8,10,8"
42+
Content="{DynamicResource flowlauncher_plugin_program_enable_description}"
43+
IsChecked="{Binding EnableDescription}"
44+
ToolTip="{DynamicResource flowlauncher_plugin_program_enable_description_tooltip}" />
5645
</StackPanel>
57-
<Separator
58-
Height="1"
59-
BorderBrush="{DynamicResource Color03B}"
60-
BorderThickness="1" />
46+
<Separator Height="1" BorderBrush="{DynamicResource Color03B}" BorderThickness="1" />
6147
</StackPanel>
62-
<StackPanel
63-
Width="Auto"
64-
Margin="10,6,0,0"
65-
HorizontalAlignment="Left"
66-
Orientation="Horizontal">
67-
<Button
68-
x:Name="btnLoadAllProgramSource"
69-
Width="100"
70-
Margin="10"
71-
HorizontalAlignment="Right"
72-
Click="btnLoadAllProgramSource_OnClick"
73-
Content="{DynamicResource flowlauncher_plugin_program_all_programs}" />
74-
<Button
75-
x:Name="btnProgramSuffixes"
76-
Width="100"
77-
Margin="10"
78-
HorizontalAlignment="Right"
79-
Click="BtnProgramSuffixes_OnClick"
80-
Content="{DynamicResource flowlauncher_plugin_program_suffixes}" />
81-
<Button
82-
x:Name="btnReindex"
83-
Width="100"
84-
Margin="10"
85-
HorizontalAlignment="Right"
86-
Click="btnReindex_Click"
87-
Content="{DynamicResource flowlauncher_plugin_program_reindex}" />
88-
<StackPanel
89-
x:Name="indexingPanel"
90-
HorizontalAlignment="Left"
91-
Orientation="Horizontal"
92-
Visibility="Hidden">
93-
<ProgressBar
94-
x:Name="progressBarIndexing"
95-
Width="80"
96-
Height="20"
97-
IsIndeterminate="True"
98-
Maximum="100"
99-
Minimum="0" />
100-
<TextBlock
101-
Height="20"
102-
Margin="10,0,0,0"
103-
HorizontalAlignment="Center"
104-
Text="{DynamicResource flowlauncher_plugin_program_indexing}" />
48+
<StackPanel Width="Auto"
49+
Margin="10,6,0,0"
50+
HorizontalAlignment="Left"
51+
Orientation="Horizontal">
52+
<Button x:Name="btnLoadAllProgramSource"
53+
Width="100"
54+
Margin="10"
55+
HorizontalAlignment="Right"
56+
Click="btnLoadAllProgramSource_OnClick"
57+
Content="{DynamicResource flowlauncher_plugin_program_all_programs}" />
58+
<Button x:Name="btnProgramSuffixes"
59+
Width="100"
60+
Margin="10"
61+
HorizontalAlignment="Right"
62+
Click="BtnProgramSuffixes_OnClick"
63+
Content="{DynamicResource flowlauncher_plugin_program_suffixes}" />
64+
<Button x:Name="btnReindex"
65+
Width="100"
66+
Margin="10"
67+
HorizontalAlignment="Right"
68+
Click="btnReindex_Click"
69+
Content="{DynamicResource flowlauncher_plugin_program_reindex}" />
70+
<StackPanel x:Name="indexingPanel"
71+
HorizontalAlignment="Left"
72+
Orientation="Horizontal"
73+
Visibility="Hidden">
74+
<ProgressBar x:Name="progressBarIndexing"
75+
Width="80"
76+
Height="20"
77+
IsIndeterminate="True"
78+
Maximum="100"
79+
Minimum="0" />
80+
<TextBlock Height="20"
81+
Margin="10,0,0,0"
82+
HorizontalAlignment="Center"
83+
Text="{DynamicResource flowlauncher_plugin_program_indexing}" />
10584
</StackPanel>
10685
</StackPanel>
10786
</StackPanel>
108-
<ListView
109-
x:Name="programSourceView"
110-
Grid.Row="1"
111-
Margin="20,0,20,0"
112-
AllowDrop="True"
113-
BorderBrush="DarkGray"
114-
BorderThickness="1"
115-
DragEnter="programSourceView_DragEnter"
116-
Drop="programSourceView_Drop"
117-
GridViewColumnHeader.Click="GridViewColumnHeaderClickedHandler"
118-
PreviewMouseRightButtonUp="ProgramSourceView_PreviewMouseRightButtonUp"
119-
SelectionMode="Extended"
120-
Style="{StaticResource {x:Static GridView.GridViewStyleKey}}">
87+
<ListView x:Name="programSourceView"
88+
Grid.Row="1"
89+
Margin="20,0,20,0"
90+
AllowDrop="True"
91+
BorderBrush="DarkGray"
92+
BorderThickness="1"
93+
DragEnter="programSourceView_DragEnter"
94+
Drop="programSourceView_Drop"
95+
GridViewColumnHeader.Click="GridViewColumnHeaderClickedHandler"
96+
PreviewMouseRightButtonUp="ProgramSourceView_PreviewMouseRightButtonUp"
97+
SelectionMode="Extended"
98+
Style="{StaticResource {x:Static GridView.GridViewStyleKey}}">
12199
<ListView.ItemContainerStyle>
122100
<!--<Style BasedOn="{StaticResource DefaultListViewItemStyle}" TargetType="ListViewItem"> for Darkmode Style -->
123101
<Style TargetType="ListViewItem">
@@ -137,10 +115,7 @@
137115
<GridViewColumn Header="Enabled">
138116
<GridViewColumn.CellTemplate>
139117
<DataTemplate>
140-
<TextBlock
141-
MaxWidth="60"
142-
Text="{Binding Enabled}"
143-
TextAlignment="Center" />
118+
<TextBlock MaxWidth="60" Text="{Binding Enabled}" TextAlignment="Center" />
144119
</DataTemplate>
145120
</GridViewColumn.CellTemplate>
146121
</GridViewColumn>
@@ -154,29 +129,23 @@
154129
</GridView>
155130
</ListView.View>
156131
</ListView>
157-
<DockPanel
158-
Grid.Row="2"
159-
Grid.RowSpan="1"
160-
Margin="0,0,20,10">
132+
<DockPanel Grid.Row="2" Grid.RowSpan="1" Margin="0,0,20,10">
161133
<StackPanel HorizontalAlignment="Right" Orientation="Horizontal">
162-
<Button
163-
x:Name="btnProgramSourceStatus"
164-
Width="100"
165-
Margin="10"
166-
Click="btnProgramSourceStatus_OnClick"
167-
Content="{DynamicResource flowlauncher_plugin_program_disable}" />
168-
<Button
169-
x:Name="btnEditProgramSource"
170-
Width="100"
171-
Margin="10"
172-
Click="btnEditProgramSource_OnClick"
173-
Content="{DynamicResource flowlauncher_plugin_program_edit}" />
174-
<Button
175-
x:Name="btnAddProgramSource"
176-
Width="100"
177-
Margin="10,10,0,10"
178-
Click="btnAddProgramSource_OnClick"
179-
Content="{DynamicResource flowlauncher_plugin_program_add}" />
134+
<Button x:Name="btnProgramSourceStatus"
135+
Width="100"
136+
Margin="10"
137+
Click="btnProgramSourceStatus_OnClick"
138+
Content="{DynamicResource flowlauncher_plugin_program_disable}" />
139+
<Button x:Name="btnEditProgramSource"
140+
Width="100"
141+
Margin="10"
142+
Click="btnEditProgramSource_OnClick"
143+
Content="{DynamicResource flowlauncher_plugin_program_edit}" />
144+
<Button x:Name="btnAddProgramSource"
145+
Width="100"
146+
Margin="10,10,0,10"
147+
Click="btnAddProgramSource_OnClick"
148+
Content="{DynamicResource flowlauncher_plugin_program_add}" />
180149
</StackPanel>
181150
</DockPanel>
182151
</Grid>

Plugins/Flow.Launcher.Plugin.Program/Views/ProgramSetting.xaml.cs

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,20 @@ public partial class ProgramSetting : UserControl
3030
public bool EnableDescription
3131
{
3232
get => _settings.EnableDescription;
33-
set => _settings.EnableDescription = value;
33+
set
34+
{
35+
Main.ResetCache();
36+
_settings.EnableDescription = value;
37+
}
3438
}
35-
public bool EnableHideAppsPath
39+
public bool HideAppsPath
3640
{
37-
get => _settings.EnableHideAppsPath;
38-
set => _settings.EnableHideAppsPath = value;
41+
get => _settings.HideAppsPath;
42+
set
43+
{
44+
Main.ResetCache();
45+
_settings.HideAppsPath = value;
46+
}
3947
}
4048

4149
public bool EnableRegistrySource
@@ -110,7 +118,6 @@ private void ViewRefresh()
110118
private async void ReIndexing()
111119
{
112120
ViewRefresh();
113-
114121
indexingPanel.Visibility = Visibility.Visible;
115122
await Main.IndexPrograms();
116123
indexingPanel.Visibility = Visibility.Hidden;

0 commit comments

Comments
 (0)