Browse Source

信息栏增加异常显示红色

master
sc 3 months ago
parent
commit
2148bb0b9d
  1. 2
      MainWindow.xaml
  2. 3
      UserClass/ERRinf.cs
  3. 66
      ViewModel/MainWindowViewModel.cs

2
MainWindow.xaml

@ -117,7 +117,7 @@
IsReadOnly="True" IsUndoEnabled="False" MaxLines="1" IsEnabled="False"/>
<TextBox Text="{Binding Status_Str}" HorizontalAlignment="Center" Height="50" Margin="0,0,0,0"
TextWrapping="Wrap" VerticalAlignment="Top" Width="700" FontSize="35"
Background="{x:Null}" BorderBrush="{x:Null}" SelectionBrush="{x:Null}"
Background="{x:Null}" BorderBrush="{x:Null}" SelectionBrush="{x:Null}" Foreground="{Binding Status_Str_coloer}"
IsReadOnly="True" IsUndoEnabled="False" MaxLines="1" IsEnabled="False"/>
<TextBox Text="{Binding Sys_Time}" HorizontalAlignment="Right" Height="50" Margin="0,0,5,0"
TextWrapping="Wrap" VerticalAlignment="Top" Width="150" FontSize="20"

3
UserClass/ERRinf.cs

@ -38,8 +38,9 @@ namespace DyeingComputer.UserClass
public static int i=0;
public static string ERRinf_r(DataTable dataTable)//读取
{
if (i >= dataTable.Rows.Count) { i = 0; } else { i++; }
if (i < 0) { i = dataTable.Rows.Count - 1; }
string index = dataTable.Rows[i].Field<string>("INF");
i--;
return index;
}
}

66
ViewModel/MainWindowViewModel.cs

@ -1,37 +1,38 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CommonServiceLocator;
using CommunityToolkit.Mvvm.ComponentModel;
using CommonServiceLocator;
using System.Windows.Threading;
using static DyeingComputer.UserClass.SqliteHelper;
using System.Data;
using System.Collections.ObjectModel;
using DyeingComputer.View;
using System.Windows;
using CommunityToolkit.Mvvm.Input;
using DyeingComputer.Properties;
using DyeingComputer.UserClass;
using System.Reflection;
using System.Windows.Documents;
using System.Runtime.CompilerServices;
using DyeingComputer.View;
using Microsoft.Win32;
using NModbus;
using NModbus.Serial;
using System.IO.Ports;
using OpenTK.Graphics.ES11;
using DyeingComputer.Properties;
using Microsoft.Win32;
using static DyeingComputer.Windows.ViewStep;
using System.Windows.Media;
using System.Runtime.Remoting.Channels;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Data;
using System.Diagnostics.Eventing.Reader;
using System.Drawing;
using System.IO;
using System.IO.Ports;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Remoting.Channels;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Threading;
using TouchSocket.Sockets;
using static DyeingComputer.UserClass.SqliteHelper;
using static DyeingComputer.Windows.ViewStep;
using static System.Windows.Forms.VisualStyles.VisualStyleElement.Button;
using System.Windows.Input;
using CommunityToolkit.Mvvm.Input;
namespace DyeingComputer.ViewModel
@ -61,6 +62,8 @@ namespace DyeingComputer.ViewModel
public class MainWindowViewModel : ViewModelBase
{
System.Windows.Media.Brush Status_red = new SolidColorBrush() { Color = System.Windows.Media.Color.FromArgb(255, 255, 0, 0) };
System.Windows.Media.Brush Status_Black = new SolidColorBrush() { Color = System.Windows.Media.Color.FromArgb(255, 0, 0, 0) };
private static SQLiteHelper SQLiteHelpers = null; //定义数据库
private readonly static string DBAddress = Environment.CurrentDirectory + "\\DataBase\\800COMPUTER.db"; //数据库路径
private readonly string ChartAdress = Environment.CurrentDirectory + "\\DataBase\\Chart.db"; //数据库路径
@ -116,6 +119,16 @@ namespace DyeingComputer.ViewModel
OnPropertyChanged("Link_bool");
}
}
System.Windows.Media.Brush Status_str_coloer;
public System.Windows.Media.Brush Status_Str_coloer
{
get => Status_str_coloer;
set
{
Status_str_coloer = value;
OnPropertyChanged("Status_Str_coloer");
}
}
public string work_Temp; //显示温度
public string Work_Temp //通知UI控件参数改变
{
@ -414,13 +427,14 @@ namespace DyeingComputer.ViewModel
IO_view();
TechnologicalProcess_view();
if (errTabler.Rows.Count!=0)
if (errTabler.Rows.Count != 0)
{
Status_Str = ERRinf.ERRinf_r(errTabler);
Alert_red = true;
Alert_bell = true;
Status_Str_coloer = Status_red;
}
else { Status_Str_coloer = Status_Black; }
Updata_dtd("3001", Alert_red);
Updata_dtd("3003", Alert_yellow);

Loading…
Cancel
Save