mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
- Add Progressbar color converter
- Colorized(red) when usage space 90% over
This commit is contained in:
parent
4bc3367e3f
commit
eb8aa77e75
2 changed files with 34 additions and 0 deletions
32
Flow.Launcher/Converters/ProgressForegroundConverter.cs
Normal file
32
Flow.Launcher/Converters/ProgressForegroundConverter.cs
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace Flow.Launcher.Converters
|
||||
{
|
||||
public class ProgressForegroundConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
double progress = (double)value;
|
||||
string foreground = "#26a0da";
|
||||
|
||||
if (progress >= 90)
|
||||
{
|
||||
foreground = "#da2626";
|
||||
}
|
||||
|
||||
return foreground;
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -46,6 +46,7 @@
|
|||
<Grid.Resources>
|
||||
<converter:HighlightTextConverter x:Key="HighlightTextConverter" />
|
||||
<converter:OrdinalConverter x:Key="OrdinalConverter" />
|
||||
<converter:ProgressForegroundConverter x:Key="ProgressForegroundConverter" />
|
||||
<converter:OpenResultHotkeyVisibilityConverter x:Key="OpenResultHotkeyVisibilityConverter" />
|
||||
</Grid.Resources>
|
||||
<Grid.ColumnDefinitions>
|
||||
|
|
@ -113,6 +114,7 @@
|
|||
</Grid.RowDefinitions>
|
||||
<ProgressBar
|
||||
x:Name="progressbarResult"
|
||||
Foreground="{Binding RelativeSource={RelativeSource Mode=Self}, Path=Value, Converter={StaticResource ProgressForegroundConverter}}"
|
||||
Style="{DynamicResource ProgressBarResult}"
|
||||
Value="{Binding Result.ProgressBar}" />
|
||||
<TextBlock
|
||||
|
|
|
|||
Loading…
Reference in a new issue