Brush thread-safety
This commit is contained in:
1 parent
4fdea219b6
commit
0bd87e7063
6 files changed
+14
-10
No files matched your search
@@ -306,8 +306,7 @@ namespace mbts.ui {
|
||||
public static BTSColor grid_line { get { return new BTSColor(64, 0, 0, 0); } }
|
||||
}
|
||||
|
||||
public static class UI
|
||||
{
|
||||
public static class UI {
|
||||
[DisplayInfo(name = "Shell Background")]
|
||||
public static BTSColor default_background { get { return new BTSColor(0xf6, 0xf6, 0xf6); } }
|
||||
[DisplayInfo(name = "Shell Text")]
|
||||
@@ -324,6 +323,7 @@ namespace mbts.ui {
|
||||
public static BTSColor input_mouseover_background { get { return new BTSColor(0xAB, 0xAD, 0xB3); } }
|
||||
public static BTSColor input_selected_border { get { return new BTSColor(0x7E, 0xB4, 0xEA); } }
|
||||
public static BTSColor input_selected_background { get { return new BTSColor(0xAB, 0xAD, 0xB3); } }
|
||||
public static BTSColor text_prompt_foreground_color => 0x99999999;
|
||||
|
||||
public static BTSColor input_disabled_text => new BTSColor(0x87);
|
||||
public static BTSColor input_disabled_text_dark => new BTSColor(0x66);
|
||||
@@ -335,6 +335,9 @@ namespace mbts.ui {
|
||||
|
||||
public static BTSColor input_dirty_border => warning;
|
||||
|
||||
public static Brush text_prompt_foreground_brush { get; } = text_prompt_foreground_color.to_brush().frozen();
|
||||
public static Brush input_disabled_text_brush { get; } = input_disabled_text.to_brush().frozen();
|
||||
|
||||
public static class ComboBox
|
||||
{
|
||||
// Normal
|
||||
@@ -645,8 +648,8 @@ namespace mbts.ui {
|
||||
public static Color logo_gray { get { return Color.FromRgb(179, 179, 179); } }
|
||||
public static Brush logo_gray_brush { get { return new SolidColorBrush(logo_gray); } }
|
||||
|
||||
public static Color common_background { get { return UI.default_background; } }
|
||||
public static Brush common_background_brush { get { return new SolidColorBrush(common_background); } }
|
||||
public static Color common_background => UI.default_background;
|
||||
public static Brush common_background_brush { get; } = common_background.to_brush().frozen();
|
||||
|
||||
public static Color accent1 { get { return UI.accent_light; } }
|
||||
public static Brush accent1_brush { get { return new SolidColorBrush(accent1); } }
|
||||
|
||||
@@ -75,6 +75,4 @@
|
||||
<SolidColorBrush x:Key="ComboBox.Disabled.Editable.Button.Background" Color="Transparent"/>
|
||||
<SolidColorBrush x:Key="ComboBox.Disabled.Editable.Button.Border" Color="Transparent"/>
|
||||
<SolidColorBrush x:Key="ComboBox.Static.Glyph" Color="#FF606060"/>
|
||||
|
||||
<SolidColorBrush x:Key="Text.Prompt.Foreground.Brush" Color="{StaticResource Text.Prompt.Foreground.Color}"/>
|
||||
</ResourceDictionary>
|
||||
@@ -66,7 +66,7 @@
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
<Style x:Key="TextPromptStyle" TargetType="TextBlock">
|
||||
<Setter Property="Foreground" Value="{StaticResource Text.Prompt.Foreground.Brush}"/>
|
||||
<Setter Property="Foreground" Value="{x:Static text_prompt_foreground_brush, MemberType={u:Nested u:BTSColors.UI}}"/>
|
||||
<Setter Property="Margin" Value="4,0,0,0"/>
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
<Setter Property="IsHitTestVisible" Value="False"/>
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<cv:KeyValue Key="{x:Null}" Value="{u:Visibility Visible}"/>
|
||||
</cv:ValueMap>
|
||||
<Style x:Key="TextPromptStyle" TargetType="TextBlock">
|
||||
<Setter Property="Foreground" Value="{StaticResource Text.Prompt.Foreground.Brush}"/>
|
||||
<Setter Property="Foreground" Value="{x:Static text_prompt_foreground_brush, MemberType={u:Nested u:BTSColors.UI}}"/>
|
||||
<Setter Property="Margin" Value="4,0,0,0"/>
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
<Setter Property="IsHitTestVisible" Value="False"/>
|
||||
|
||||
@@ -68,6 +68,9 @@ namespace mbts.ui {
|
||||
return Color.FromRgb(bytes[2], bytes[1], bytes[0]);
|
||||
}
|
||||
|
||||
public static SolidColorBrush to_brush(this BTSColor color) =>
|
||||
new SolidColorBrush(color);
|
||||
|
||||
public static Brush rgb_brush(this uint color) {
|
||||
var brush = new SolidColorBrush(rgb_color(color));
|
||||
brush.Freeze();
|
||||
|
||||
@@ -63,8 +63,8 @@
|
||||
<cv:ValueMap x:Key="IsEnabledOpacityConverter" Default="{u:Double 1}">
|
||||
<cv:KeyValue Key="{u:False}" Value="{u:Double 0.56}" />
|
||||
</cv:ValueMap>
|
||||
<cv:ValueMap x:Key="IsEnabledForegroundConverter" Default="{u:Brush Black}">
|
||||
<cv:KeyValue Key="{u:False}" Value="{u:Brush Gray}"/>
|
||||
<cv:ValueMap x:Key="IsEnabledForegroundConverter" Default="{x:Static Brushes.Black}">
|
||||
<cv:KeyValue Key="{u:False}" Value="{x:Static input_disabled_text_brush, MemberType={u:Nested u:BTSColors.UI}}"/>
|
||||
</cv:ValueMap>
|
||||
<uspcv:TickDisplayConverter x:Key="TickDisplayConverter"/>
|
||||
<cv:ImageSourceIconConverter x:Key="IconConverter"/>
|
||||
|
||||
Reference in new issue
Block a user