MainView中License到期剩余天数小于3天时,剩余天数显示为红色。
This commit is contained in:
parent
b8f991ed93
commit
5de77049a8
|
@ -0,0 +1,31 @@
|
|||
using System;
|
||||
using System.Drawing;
|
||||
using System.Globalization;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Media;
|
||||
using Brush = System.Windows.Media.Brush;
|
||||
|
||||
namespace SicUI.Converter
|
||||
{
|
||||
public class LicenseExpiredToColorConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
Brush foreground;
|
||||
if (parameter is Brush brush)
|
||||
foreground = brush;
|
||||
else
|
||||
foreground = new SolidColorBrush(Colors.White);
|
||||
|
||||
if (value is int and <= 3)
|
||||
foreground = new SolidColorBrush(Colors.Red);
|
||||
|
||||
return foreground;
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -856,6 +856,8 @@
|
|||
</Grid.RowDefinitions>
|
||||
|
||||
<Grid.Resources>
|
||||
<converter:LicenseExpiredToColorConverter x:Key="ExpiredToColorConverter"/>
|
||||
|
||||
<Style x:Key="TextBlockBaseStyle" TargetType="TextBlock">
|
||||
<Setter Property="Foreground" Value="{DynamicResource FG_White}"/>
|
||||
<Setter Property="FontSize" Value="11"/>
|
||||
|
@ -891,6 +893,9 @@
|
|||
<TextBlock Grid.Row="3" Grid.Column="0" Text="Expired" Style="{StaticResource CaptionStyle}"/>
|
||||
<TextBlock Grid.Row="3" Grid.Column="1" d:Text="1 Days"
|
||||
Text="{Binding CDKeyDaysLeft, StringFormat={}{0} Days}"
|
||||
Foreground="{Binding CDKeyDaysLeft,
|
||||
Converter={StaticResource ExpiredToColorConverter},
|
||||
ConverterParameter={StaticResource FG_White}}"
|
||||
Style="{StaticResource ContentStyle}"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
|
|
@ -1146,7 +1146,7 @@ namespace SicUI.Client
|
|||
public string CDKeyCreationDate { get; set; }
|
||||
|
||||
[Subscription($"System.CDKeyDaysLeft")]
|
||||
public string CDKeyDaysLeft { get; set; }
|
||||
public int CDKeyDaysLeft { get; set; }
|
||||
|
||||
public string ActivateMessage { get; private set; }
|
||||
|
||||
|
|
|
@ -246,6 +246,7 @@ if exist "$(ProjectDir)..\SicSetup\Packages\SicUI\PresetGroups" rd "$(ProjectDir
|
|||
<Compile Include="Controls\WaferAssociationUnitLite.xaml.cs">
|
||||
<DependentUpon>WaferAssociationUnitLite.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Converter\LicenseExpiredToColorConverter.cs" />
|
||||
<Compile Include="GlobalUsings.cs" />
|
||||
<Compile Include="Models\Maintenances\RuntimeView.xaml.cs">
|
||||
<DependentUpon>RuntimeView.xaml</DependentUpon>
|
||||
|
|
Loading…
Reference in New Issue