diff --git a/BPASmartClient.ViewModel/LogOrAlarmViewModel.cs b/BPASmartClient.ViewModel/LogOrAlarmViewModel.cs index 4e097ed9..39c1c7e4 100644 --- a/BPASmartClient.ViewModel/LogOrAlarmViewModel.cs +++ b/BPASmartClient.ViewModel/LogOrAlarmViewModel.cs @@ -158,8 +158,8 @@ namespace BPASmartClient.ViewModel LogDataGrid.Clear(); //2.根据选中查询日志 DataTable dataTable = ReadFile(path); - DataRow[] datas = dataTable.Select(sql); - if (datas.Count() <= 0) + List datas = dataTable.Select($"({sql})").OrderByDescending(o => o["TIME"])?.ToList(); + if (datas==null || datas.Count() <= 0) { NoticeDemoViewModel.OpenMsg(EnumPromptType.Info, MainViewModel.GetInstance().window, "提示", $"查询结果为空!"); return; @@ -170,8 +170,8 @@ namespace BPASmartClient.ViewModel { time = item["TIME"].ToString(), type = item["LOGGER"].ToString(), - message = item["MESSAGE"].ToString(), - foreground = (item["LOGGER"].ToString() == "Error" || item["LOGGER"].ToString() == "DeviceAlarm") ? new SolidColorBrush((System.Windows.Media.Color)System.Windows.Media.ColorConverter.ConvertFromString("#ed0032")) : new SolidColorBrush((System.Windows.Media.Color)System.Windows.Media.ColorConverter.ConvertFromString("#21bb2e")) + message = item["MESSAGE"].ToString() + // foreground = (item["LOGGER"].ToString() == "ERROR" || item["LOGGER"].ToString() == "DEVICEALARM") ? new SolidColorBrush((System.Windows.Media.Color)System.Windows.Media.ColorConverter.ConvertFromString("#ed0032")) : new SolidColorBrush((System.Windows.Media.Color)System.Windows.Media.ColorConverter.ConvertFromString("#21bb2e")) }); } } diff --git a/BPASmartClient.ViewModel/LogViewModel.cs b/BPASmartClient.ViewModel/LogViewModel.cs index 0088abaa..5c5e2bb8 100644 --- a/BPASmartClient.ViewModel/LogViewModel.cs +++ b/BPASmartClient.ViewModel/LogViewModel.cs @@ -233,7 +233,7 @@ namespace BPASmartClient.ViewModel if (_type == value) return; _type = value; - if (_type == "Error") foreground = new SolidColorBrush((System.Windows.Media.Color)System.Windows.Media.ColorConverter.ConvertFromString("#ed0032")); + if (_type == "Error" || _type == "Error".ToUpper() || _type == "DeviceAlarm".ToUpper() || _type == "DeviceAlarm") foreground = new SolidColorBrush((System.Windows.Media.Color)System.Windows.Media.ColorConverter.ConvertFromString("#ed0032")); OnPropertyChanged("type"); OnPropertyChanged("foreground");