|
|
@@ -1,6 +1,7 @@
|
|
|
-using SWRIS.Models;
|
|
|
+using SWRIS.Enums;
|
|
|
+using SWRIS.Models;
|
|
|
using System;
|
|
|
-using System.Collections.ObjectModel;
|
|
|
+using System.Collections.Generic;
|
|
|
using System.Globalization;
|
|
|
using System.Linq;
|
|
|
using System.Windows.Data;
|
|
|
@@ -13,16 +14,16 @@ namespace SWRIS.Converters
|
|
|
private static readonly SolidColorBrush OnlineBrush = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#00FF78"));
|
|
|
private static readonly SolidColorBrush OfflineBrush = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#7886B2"));
|
|
|
private static readonly SolidColorBrush FaultBrush = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#FF0000"));
|
|
|
-
|
|
|
+
|
|
|
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
|
|
|
{
|
|
|
- if (values.Length < 2 || !(values[0] is bool isConnected) || !(values[1] is ObservableCollection<FaultDataModel> faults))
|
|
|
+ if (values.Length < 2 || !(values[0] is bool isConnected) || !(values[1] is Dictionary<FaultType, FaultDataModel> faults))
|
|
|
return OfflineBrush;
|
|
|
|
|
|
if (!isConnected)
|
|
|
return OfflineBrush;
|
|
|
|
|
|
- if (faults != null && faults.Any(f => f != null)) // 检查非空故障
|
|
|
+ if (faults != null && faults.Any(f => f.Value != null)) // 检查非空故障
|
|
|
return FaultBrush;
|
|
|
|
|
|
return OnlineBrush;
|