diff --git a/ConvertMoels/BoolRBConvert.cs b/ConvertMoels/BoolRBConvert.cs deleted file mode 100644 index 4c05bf0..0000000 --- a/ConvertMoels/BoolRBConvert.cs +++ /dev/null @@ -1,32 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Globalization; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Data; - -namespace DyeingComputer.ConvertMoels -{ - internal class BoolRBConvert : IValueConverter - { - public object Convert(object value, Type targetType, object parameter, CultureInfo culture) - { - bool G =(Boolean) value; - // bool G = (bool)value; - if (!G)//判断单元格值是否为零 - { - return "";//零返回 - } - else - { - return "red";//非零返回红色 - } - } - - public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) - { - return ""; - } - } -} diff --git a/ConvertMoels/StateToColorConvert.cs b/ConvertMoels/StateToColorConvert.cs new file mode 100644 index 0000000..c78cf21 --- /dev/null +++ b/ConvertMoels/StateToColorConvert.cs @@ -0,0 +1,37 @@ +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 SunlightCentralizedControlManagement_SCCM_.ConvertMoels +{ + internal class StateToColorConvert : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + if (value == null) + { + return null; + } + else + { + string Staten = null; + string i = value.ToString(); + + if (i == "101") return "Gray"; + else if (i == "201") return "green"; + else if (i == "202") return "yellow"; + else return "Red"; + } + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + return "Gray"; + } + } +} diff --git a/MainWindow.xaml b/MainWindow.xaml index 16c0ada..844fecf 100644 --- a/MainWindow.xaml +++ b/MainWindow.xaml @@ -87,7 +87,7 @@ - + diff --git a/SunlightCentralizedControlManagement_SCCM_.csproj b/SunlightCentralizedControlManagement_SCCM_.csproj index d81c733..2433143 100644 --- a/SunlightCentralizedControlManagement_SCCM_.csproj +++ b/SunlightCentralizedControlManagement_SCCM_.csproj @@ -139,7 +139,7 @@ App.xaml Code - + diff --git a/View/CurveView.xaml b/View/CurveView.xaml index 1c95d80..25e58a9 100644 --- a/View/CurveView.xaml +++ b/View/CurveView.xaml @@ -7,19 +7,109 @@ xmlns:viewmodel="clr-namespace:SunlightCentralizedControlManagement_SCCM_.ViewModel" xmlns:local="clr-namespace:SunlightCentralizedControlManagement_SCCM_.View" xmlns:lang="clr-namespace:SunlightCentralizedControlManagement_SCCM_.Properties" - xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" + xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" + xmlns:ConvertMoels="clr-namespace:SunlightCentralizedControlManagement_SCCM_.ConvertMoels" mc:Ignorable="d" Loaded="UserControl_Loaded" d:DataContext="{d:DesignInstance Type=viewmodel:CurveDiagramViewModel}" d:DesignHeight="900" d:DesignWidth="1800"> + + + - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +