Merge remote-tracking branch 'upstream/dev' into FixBookmarkDependencies

This commit is contained in:
Vic 2022-11-15 18:19:28 +08:00
commit f92760f80e
6 changed files with 45 additions and 37 deletions

View file

@ -89,7 +89,7 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="InputSimulator" Version="1.0.4" />
<PackageReference Include="Microsoft.Toolkit.Uwp.Notifications" Version="7.1.2" />
<PackageReference Include="Microsoft.Toolkit.Uwp.Notifications" Version="7.1.3" />
<PackageReference Include="ModernWpfUI" Version="0.9.4" />
<PackageReference Include="NHotkey.Wpf" Version="2.1.0" />
<PackageReference Include="NuGet.CommandLine" Version="5.7.2">

View file

@ -92,6 +92,7 @@
<system:String x:Key="plugin_query_time">Query time:</system:String>
<system:String x:Key="plugin_query_version">| Version</system:String>
<system:String x:Key="plugin_query_web">Website</system:String>
<system:String x:Key="plugin_uninstall">Uninstall</system:String>
<!-- Setting Plugin Store -->

View file

@ -5,11 +5,12 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Title="{DynamicResource flowlauncher_plugin_program_directory}"
Width="530"
Width="Auto"
Height="276"
Background="{DynamicResource PopuBGColor}"
Foreground="{DynamicResource PopupTextColor}"
ResizeMode="NoResize"
SizeToContent="Height"
SizeToContent="Width"
WindowStartupLocation="CenterScreen">
<WindowChrome.WindowChrome>
<WindowChrome CaptionHeight="32" ResizeBorderThickness="{x:Static SystemParameters.WindowResizeBorderThickness}" />
@ -69,9 +70,9 @@
TextAlignment="Left"
TextWrapping="WrapWithOverflow" />
</StackPanel>
<StackPanel Margin="0,10,0,0" Orientation="Horizontal">
<Grid Width="470">
<StackPanel Margin="0,10,10,0" Orientation="Horizontal">
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
@ -88,21 +89,22 @@
VerticalAlignment="Center"
FontSize="14"
Text="{DynamicResource flowlauncher_plugin_program_directory}" />
<DockPanel
Grid.Row="0"
Grid.Column="1"
<DockPanel
Grid.Row="0"
Grid.Column="1"
LastChildFill="True">
<Button
Width="70"
HorizontalAlignment="Right"
MinWidth="70"
HorizontalAlignment="Stretch"
Click="BrowseButton_Click"
DockPanel.Dock="Right"
Content="{DynamicResource flowlauncher_plugin_program_browse}" />
Content="{DynamicResource flowlauncher_plugin_program_browse}"
DockPanel.Dock="Right" />
<TextBox
Name="Directory"
MinWidth="300"
Margin="10"
VerticalAlignment="Center"
HorizontalAlignment="Stretch" />
HorizontalAlignment="Stretch"
VerticalAlignment="Center" />
</DockPanel>
<TextBlock
Grid.Row="1"
@ -112,7 +114,8 @@
VerticalAlignment="Center"
FontSize="14"
Text="{DynamicResource flowlauncher_plugin_program_enabled}" />
<CheckBox x:Name="Chkbox"
<CheckBox
x:Name="Chkbox"
Grid.Row="1"
Grid.Column="1"
Margin="10,0"

View file

@ -277,7 +277,8 @@ namespace Flow.Launcher.Plugin.Program.Programs
[Serializable]
public class Application : IProgram
{
public string UniqueIdentifier { get; set; }
private string _uid = string.Empty;
public string UniqueIdentifier { get => _uid; set => _uid = value == null ? string.Empty : value.ToLowerInvariant(); }
public string DisplayName { get; set; }
public string Description { get; set; }
public string UserModelId { get; set; }

View file

@ -23,7 +23,7 @@ namespace Flow.Launcher.Plugin.Program.Programs
public class Win32 : IProgram, IEquatable<Win32>
{
public string Name { get; set; }
public string UniqueIdentifier { get => _uid; set => _uid = value.ToLowerInvariant(); } // For path comparison
public string UniqueIdentifier { get => _uid; set => _uid = value == null ? string.Empty : value.ToLowerInvariant(); } // For path comparison
public string IcoPath { get; set; }
public string FullPath { get; set; }
public string LnkResolvedPath { get; set; }

View file

@ -15,37 +15,39 @@ namespace Flow.Launcher.Plugin.Program.Views.Models
/// </remarks>
public class ProgramSource
{
private string name;
private string name = string.Empty;
private string loc = string.Empty;
private string uniqueIdentifier = string.Empty;
private string loc;
public string Location
{
get => loc;
set
{
loc = value;
UniqueIdentifier = value.ToLowerInvariant();
loc = value ?? string.Empty;
UniqueIdentifier = value;
}
}
public string Name { get => name ?? new DirectoryInfo(Location).Name; set => name = value; }
public string Name { get => name; set => name = value ?? string.Empty; }
public bool Enabled { get; set; } = true;
public string UniqueIdentifier { get; private set; }
public string UniqueIdentifier
{
get => uniqueIdentifier;
private set
{
uniqueIdentifier = value == null ? string.Empty : value.ToLowerInvariant();
}
}
[JsonConstructor]
public ProgramSource(string name, string location, bool enabled, string uniqueIdentifier)
{
loc = location;
this.name = name;
loc = location ?? string.Empty;
Name = name;
Enabled = enabled;
if (location.Equals(uniqueIdentifier, StringComparison.OrdinalIgnoreCase))
{
UniqueIdentifier = location.ToLowerInvariant(); // To make sure old config can be reset to case-insensitive
}
else
{
UniqueIdentifier = uniqueIdentifier; // For uwp apps
}
UniqueIdentifier = uniqueIdentifier;
}
/// <summary>
@ -55,14 +57,15 @@ namespace Flow.Launcher.Plugin.Program.Views.Models
/// <param name="enabled">enabled</param>
public ProgramSource(string location, bool enabled = true)
{
loc = location;
loc = location ?? string.Empty;
Enabled = enabled;
UniqueIdentifier = location.ToLowerInvariant(); // For path comparison
UniqueIdentifier = location; // For path comparison
Name = new DirectoryInfo(Location).Name;
}
public ProgramSource(IProgram source)
{
loc = source.Location;
loc = source.Location ?? string.Empty;
Name = source.Name;
Enabled = source.Enabled;
UniqueIdentifier = source.UniqueIdentifier;