Skip to content

Commit e4981fa

Browse files
Merge branch 'dev' into dev
2 parents afa461c + 4550946 commit e4981fa

File tree

5 files changed

+44
-37
lines changed

5 files changed

+44
-37
lines changed

Flow.Launcher/Flow.Launcher.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@
8989
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
9090
</PackageReference>
9191
<PackageReference Include="InputSimulator" Version="1.0.4" />
92-
<PackageReference Include="Microsoft.Toolkit.Uwp.Notifications" Version="7.1.2" />
92+
<PackageReference Include="Microsoft.Toolkit.Uwp.Notifications" Version="7.1.3" />
9393
<PackageReference Include="ModernWpfUI" Version="0.9.4" />
9494
<PackageReference Include="NHotkey.Wpf" Version="2.1.0" />
9595
<PackageReference Include="NuGet.CommandLine" Version="5.7.2">

Plugins/Flow.Launcher.Plugin.Program/AddProgramSource.xaml

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@
55
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
66
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
77
Title="{DynamicResource flowlauncher_plugin_program_directory}"
8-
Width="530"
8+
Width="Auto"
9+
Height="276"
910
Background="{DynamicResource PopuBGColor}"
1011
Foreground="{DynamicResource PopupTextColor}"
1112
ResizeMode="NoResize"
12-
SizeToContent="Height"
13+
SizeToContent="Width"
1314
WindowStartupLocation="CenterScreen">
1415
<WindowChrome.WindowChrome>
1516
<WindowChrome CaptionHeight="32" ResizeBorderThickness="{x:Static SystemParameters.WindowResizeBorderThickness}" />
@@ -69,9 +70,9 @@
6970
TextAlignment="Left"
7071
TextWrapping="WrapWithOverflow" />
7172
</StackPanel>
72-
73-
<StackPanel Margin="0,10,0,0" Orientation="Horizontal">
74-
<Grid Width="470">
73+
74+
<StackPanel Margin="0,10,10,0" Orientation="Horizontal">
75+
<Grid>
7576
<Grid.RowDefinitions>
7677
<RowDefinition />
7778
<RowDefinition />
@@ -88,21 +89,22 @@
8889
VerticalAlignment="Center"
8990
FontSize="14"
9091
Text="{DynamicResource flowlauncher_plugin_program_directory}" />
91-
<DockPanel
92-
Grid.Row="0"
93-
Grid.Column="1"
92+
<DockPanel
93+
Grid.Row="0"
94+
Grid.Column="1"
9495
LastChildFill="True">
9596
<Button
96-
Width="70"
97-
HorizontalAlignment="Right"
97+
MinWidth="70"
98+
HorizontalAlignment="Stretch"
9899
Click="BrowseButton_Click"
99-
DockPanel.Dock="Right"
100-
Content="{DynamicResource flowlauncher_plugin_program_browse}" />
100+
Content="{DynamicResource flowlauncher_plugin_program_browse}"
101+
DockPanel.Dock="Right" />
101102
<TextBox
102103
Name="Directory"
104+
MinWidth="300"
103105
Margin="10"
104-
VerticalAlignment="Center"
105-
HorizontalAlignment="Stretch" />
106+
HorizontalAlignment="Stretch"
107+
VerticalAlignment="Center" />
106108
</DockPanel>
107109
<TextBlock
108110
Grid.Row="1"
@@ -112,7 +114,8 @@
112114
VerticalAlignment="Center"
113115
FontSize="14"
114116
Text="{DynamicResource flowlauncher_plugin_program_enabled}" />
115-
<CheckBox x:Name="Chkbox"
117+
<CheckBox
118+
x:Name="Chkbox"
116119
Grid.Row="1"
117120
Grid.Column="1"
118121
Margin="10,0"

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,8 @@ public override int GetHashCode()
277277
[Serializable]
278278
public class Application : IProgram
279279
{
280-
public string UniqueIdentifier { get; set; }
280+
private string _uid = string.Empty;
281+
public string UniqueIdentifier { get => _uid; set => _uid = value == null ? string.Empty : value.ToLowerInvariant(); }
281282
public string DisplayName { get; set; }
282283
public string Description { get; set; }
283284
public string UserModelId { get; set; }

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ namespace Flow.Launcher.Plugin.Program.Programs
2323
public class Win32 : IProgram, IEquatable<Win32>
2424
{
2525
public string Name { get; set; }
26-
public string UniqueIdentifier { get => _uid; set => _uid = value.ToLowerInvariant(); } // For path comparison
26+
public string UniqueIdentifier { get => _uid; set => _uid = value == null ? string.Empty : value.ToLowerInvariant(); } // For path comparison
2727
public string IcoPath { get; set; }
2828
public string FullPath { get; set; }
2929
public string LnkResolvedPath { get; set; }

Plugins/Flow.Launcher.Plugin.Program/Views/Models/ProgramSource.cs

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -15,37 +15,39 @@ namespace Flow.Launcher.Plugin.Program.Views.Models
1515
/// </remarks>
1616
public class ProgramSource
1717
{
18-
private string name;
18+
private string name = string.Empty;
19+
private string loc = string.Empty;
20+
private string uniqueIdentifier = string.Empty;
1921

20-
private string loc;
2122
public string Location
2223
{
2324
get => loc;
2425
set
2526
{
26-
loc = value;
27-
UniqueIdentifier = value.ToLowerInvariant();
27+
loc = value ?? string.Empty;
28+
UniqueIdentifier = value;
2829
}
2930
}
30-
public string Name { get => name ?? new DirectoryInfo(Location).Name; set => name = value; }
31+
32+
public string Name { get => name; set => name = value ?? string.Empty; }
3133
public bool Enabled { get; set; } = true;
3234

33-
public string UniqueIdentifier { get; private set; }
35+
public string UniqueIdentifier
36+
{
37+
get => uniqueIdentifier;
38+
private set
39+
{
40+
uniqueIdentifier = value == null ? string.Empty : value.ToLowerInvariant();
41+
}
42+
}
3443

3544
[JsonConstructor]
3645
public ProgramSource(string name, string location, bool enabled, string uniqueIdentifier)
3746
{
38-
loc = location;
39-
this.name = name;
47+
loc = location ?? string.Empty;
48+
Name = name;
4049
Enabled = enabled;
41-
if (location.Equals(uniqueIdentifier, StringComparison.OrdinalIgnoreCase))
42-
{
43-
UniqueIdentifier = location.ToLowerInvariant(); // To make sure old config can be reset to case-insensitive
44-
}
45-
else
46-
{
47-
UniqueIdentifier = uniqueIdentifier; // For uwp apps
48-
}
50+
UniqueIdentifier = uniqueIdentifier;
4951
}
5052

5153
/// <summary>
@@ -55,14 +57,15 @@ public ProgramSource(string name, string location, bool enabled, string uniqueId
5557
/// <param name="enabled">enabled</param>
5658
public ProgramSource(string location, bool enabled = true)
5759
{
58-
loc = location;
60+
loc = location ?? string.Empty;
5961
Enabled = enabled;
60-
UniqueIdentifier = location.ToLowerInvariant(); // For path comparison
62+
UniqueIdentifier = location; // For path comparison
63+
Name = new DirectoryInfo(Location).Name;
6164
}
6265

6366
public ProgramSource(IProgram source)
6467
{
65-
loc = source.Location;
68+
loc = source.Location ?? string.Empty;
6669
Name = source.Name;
6770
Enabled = source.Enabled;
6871
UniqueIdentifier = source.UniqueIdentifier;

0 commit comments

Comments
 (0)