From 7bf89fd93bc487e8445d6d85bb527251b7371a04 Mon Sep 17 00:00:00 2001
From: alielie <alielie@git.com>
Date: 星期一, 12 五月 2025 13:14:11 +0800
Subject: [PATCH] 优化项目;
---
HMI.IOMonitor/IOMonitor.xaml.cs | 59 +++++++++++++++++++++++++----------------------------------
1 files changed, 25 insertions(+), 34 deletions(-)
diff --git a/HMI.IOMonitor/IOMonitor.xaml.cs b/HMI.IOMonitor/IOMonitor.xaml.cs
index 99394ff..5778b04 100644
--- a/HMI.IOMonitor/IOMonitor.xaml.cs
+++ b/HMI.IOMonitor/IOMonitor.xaml.cs
@@ -1,26 +1,24 @@
-锘縰sing System.Collections.Generic;
-using System.Configuration;
-using System;
-using System.Windows;
-using System.Windows.Controls;
+锘縰sing ConnectionUtil;
using HMI.Base;
-using HMI.Core.Api;
-using HMI.IOMonitor.Entity;
-using log4net;
-using System.Linq;
-using System.IO;
-using HMI.Core.Util;
-using System.Collections.ObjectModel;
using HMI.Core.Setting;
+using HMI.Core.Util;
+using HMI.IOMonitor.Entity;
using HMI.UI.Util;
-using System.Timers;
-using System.Windows.Media;
-using System.Threading.Tasks;
-using System.Windows.Data;
using Microsoft.Win32;
+using NPOI.HSSF.UserModel;
using NPOI.SS.UserModel;
using NPOI.XSSF.UserModel;
-using NPOI.HSSF.UserModel;
+using OPCConnection;
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.IO;
+using System.Linq;
+using System.Net.Sockets;
+using System.Timers;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
namespace HMI.IOMonitor
{
@@ -38,7 +36,7 @@
private string DQTag = string.Empty;
private SystemSetting systemSetting;
private Timer MonitorTimer;
- private OpcInterface.OpcInterface lTSCADAApi = new OpcInterface.OpcInterface();
+ private SCADAApi lTSCADAApi = new OPCClient();
/// <summary>
@@ -48,20 +46,14 @@
/// <summary>The dis
/// DI鍙e璞�
/// </summary>
- private ObservableCollection<DIO> _dis = new ObservableCollection<DIO>() {
- new DIO(null,null,null,false),
- new DIO(null,null,null,true),
- };
+ private ObservableCollection<DIO> _dis = new ObservableCollection<DIO>();
public ObservableCollection<DIO> Dis
{
get => _dis;
set { Set(ref _dis, value); }
}
- private ObservableCollection<DIO> _dos = new ObservableCollection<DIO>() {
- new DIO(null,null,null,false),
- new DIO(null,null,null,true),
- };
+ private ObservableCollection<DIO> _dos = new ObservableCollection<DIO>();
public ObservableCollection<DIO> Dos
{
get => _dos;
@@ -301,12 +293,12 @@
{
IPManageModal modal = new IPManageModal(log)
{
- Title = "鏂板",
+ Title = this.lang("App.Add"),
Owner = Window.GetWindow(this),
};
if (modal.Open(-1, new IPManage(), IPManages, SettingFilePath) == true)
{
- this.Success("鏂板鎴愬姛");
+ this.Success(this.lang("App.AddSuccess"));
}
}
@@ -316,8 +308,8 @@
OpenFileDialog dialog = new OpenFileDialog();
////璇ュ�肩‘瀹氭槸鍚﹀彲浠ラ�夋嫨澶氫釜鏂囦欢
dialog.Multiselect = false;
- dialog.Title = "璇烽�夋嫨鏂囦欢";
- dialog.Filter = "execl鏂囦欢(*.xlsx;*.xls)|*.xlsx;*.xls";
+ dialog.Title = this.lang("App.SelectFile");
+ dialog.Filter = "execl(*.xlsx;*.xls)|*.xlsx;*.xls";
if (dialog.ShowDialog() == true)
{
MonitorTimer.Enabled = false;
@@ -382,7 +374,7 @@
catch (Exception ex)
{
log.Error("Import Failed.", ex);
- MsgBoxHelper.Error(this, $"瀵煎叆澶辫触锛亄ex.Message}");
+ MsgBoxHelper.Error(this, $"{this.lang("App.ImportFailed")}: {ex.Message}");
}
}
}
@@ -427,7 +419,7 @@
this.DataFilePath = Path.Combine(BaseFolder, "Data.xml");
}
- public override object Active()
+ public override void Active()
{
try
{
@@ -463,9 +455,8 @@
catch (Exception ex)
{
log.Error("Active Execute Failed.", ex);
- MsgBoxHelper.ErrorMessage(this, $"鎻掍欢婵�娲诲け璐ワ紒{ex.Message}");
+ MsgBoxHelper.ErrorMessage(this, $"{this.lang("DIO.ActivateFailed")}: {ex.Message}");
}
- return null;
}
private void CollectionViewSource_Filter(object sender, System.Windows.Data.FilterEventArgs e)
--
Gitblit v1.9.1