Fixed Progressbar Binding Error (ProgressBar Value is Not Nullable)

This commit is contained in:
Sparrkle 2022-09-15 15:57:05 +09:00
parent c81dd32d99
commit 314f2d6a90
4 changed files with 13 additions and 9 deletions

View file

@ -201,7 +201,12 @@ namespace Flow.Launcher.Plugin
/// <summary>
/// Progress bar display. Providing an int value between 0-100 will trigger the progress bar to be displayed on the result
/// </summary>
public int? ProgressBar { get; set; }
public int ProgressBarValue { get; set; }
/// <summary>
/// Progress bar visibility Check
/// </summary>
public bool IsProgressBarVisible { get; set; } = false;
/// <summary>
/// Optionally set the color of the progress bar

View file

@ -115,7 +115,7 @@
x:Name="progressbarResult"
Foreground="{Binding Result.ProgressBarColor}"
Style="{DynamicResource ProgressBarResult}"
Value="{Binding Result.ProgressBar}" />
Value="{Binding Result.ProgressBarValue}" />
<TextBlock
x:Name="Title"
VerticalAlignment="Center"

View file

@ -4,6 +4,8 @@
xmlns:system="clr-namespace:System;assembly=mscorlib"
xmlns:userSettings="clr-namespace:Flow.Launcher.Infrastructure.UserSettings;assembly=Flow.Launcher.Infrastructure">
<BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
<!-- Further font customisations are dynamically loaded in Theme.cs -->
<Style x:Key="BaseQueryBoxStyle" TargetType="{x:Type TextBox}">
<Setter Property="BorderThickness" Value="0" />
@ -89,11 +91,7 @@
<Setter Property="Minimum" Value="0" />
<Setter Property="Visibility" Value="Visible" />
<Setter Property="Foreground" Value="#26a0da " />
<Style.Triggers>
<DataTrigger Binding="{Binding Result.ProgressBar}" Value="{x:Null}">
<Setter Property="Visibility" Value="Collapsed" />
</DataTrigger>
</Style.Triggers>
<Setter Property="Visibility" Value="{Binding Result.IsProgressBarVisible, Converter={StaticResource BooleanToVisibilityConverter}}"/>
</Style>
<Style x:Key="BaseItemTitleStyle" TargetType="{x:Type TextBlock}">

View file

@ -80,7 +80,7 @@ namespace Flow.Launcher.Plugin.Explorer.Search
internal static Result CreateDriveSpaceDisplayResult(string path, bool windowsIndexed = false)
{
var progressBarColor = "#26a0da";
int? progressValue = null;
int progressValue = 0;
var title = string.Empty; // hide title when use progress bar,
var driveLetter = path.Substring(0, 1).ToUpper();
var driveName = driveLetter + ":\\";
@ -100,7 +100,8 @@ namespace Flow.Launcher.Plugin.Explorer.Search
AutoCompleteText = GetPathWithActionKeyword(path, ResultType.Folder),
IcoPath = path,
Score = 500,
ProgressBar = progressValue,
ProgressBarValue = progressValue,
IsProgressBarVisible = true,
ProgressBarColor = progressBarColor,
Action = c =>
{