From 2e49e6f6e64508d36c6ddd7c083d559cafc3f9aa Mon Sep 17 00:00:00 2001 From: MoYue Date: Tue, 23 Apr 2024 18:20:19 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E4=B8=AD=E5=BF=83=E5=B8=83?= =?UTF-8?q?=E5=B1=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- InSituLaboratory.Base/WorkStateConvert.cs | 41 ++ .../Views/Pages/DashboardView.xaml | 489 ++++++++++++++---- 2 files changed, 422 insertions(+), 108 deletions(-) create mode 100644 InSituLaboratory.Base/WorkStateConvert.cs diff --git a/InSituLaboratory.Base/WorkStateConvert.cs b/InSituLaboratory.Base/WorkStateConvert.cs new file mode 100644 index 0000000..45606d9 --- /dev/null +++ b/InSituLaboratory.Base/WorkStateConvert.cs @@ -0,0 +1,41 @@ +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 InSituLaboratory.Base +{ + /// + /// 工作状态转换器 + /// + public class WorkStateConvert : IValueConverter + { + public static object ConvertObject; + + object IValueConverter.Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + Brush background = null; + if ((string)value == "待机") + { + //橙色 + background = new SolidColorBrush(Color.FromRgb(255, 128, 0)); + } + else if ((string)value == "工作") + { + //绿色 + background = new SolidColorBrush(Color.FromRgb(0, 255, 0)); + } + + return background; + } + + object IValueConverter.ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/InSituLaboratory/Views/Pages/DashboardView.xaml b/InSituLaboratory/Views/Pages/DashboardView.xaml index a4216a9..6854ac5 100644 --- a/InSituLaboratory/Views/Pages/DashboardView.xaml +++ b/InSituLaboratory/Views/Pages/DashboardView.xaml @@ -7,9 +7,10 @@ xmlns:converters="clr-namespace:InSituLaboratory.Base;assembly=InSituLaboratory.Base" mc:Ignorable="d" FontFamily="{StaticResource DigitalDisplay}" - d:DesignHeight="450" d:DesignWidth="800"> + d:DesignHeight="700" d:DesignWidth="800"> + - - + - - - - - - - - - - - - - - - - + + + + + + + + + + + - - - - - - - - - - - - - + - + + + + + + - - + + + + + + + + + - - - - - - - - - - - - - + - + + + + + + - - + + + + + + + + + - - - - - - - - - - - - - + - + + + + + + - - + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + - + - - + + - + - - + + - + - - + + - + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - -