| | |
| | | using Plugin.TestResult_WPF.Model; |
| | | using HMI.Core.Util; |
| | | using Plugin.TestResult_WPF.Model; |
| | | using SuperSocket.SocketBase.Protocol; |
| | | using System; |
| | | using System.ComponentModel; |
| | | using System.Net; |
| | | using System.Net.Sockets; |
| | | using System.Runtime.CompilerServices; |
| | | using System.Threading; |
| | | using System.Windows; |
| | | using System.Windows.Controls; |
| | | |
| | |
| | | set { RaiseAndSetIfchanged(ref tcpServerStatus, value); } |
| | | } |
| | | |
| | | private string tcpServerInfo = "未启动"; |
| | | private string tcpServerInfo = LangUtil.Get("App.NotStarted"); |
| | | |
| | | public string TcpServerInfo |
| | | { |
| | |
| | | DataContext = this; |
| | | InitializeComponent(); |
| | | this.chart = new Chart(this.chartTitle, false, config.MaxSize, config.RefreshInterval); |
| | | this.multiChart = new Chart(config.DetailChartTitle, true, config.MaxSize, config.RefreshInterval); |
| | | this.multiChart = new Chart(config.DetailChartTitle, true, config.MaxSize, config.RefreshInterval) { |
| | | BorderThickness = new Thickness(0) |
| | | }; |
| | | this.grid.Children.Add(this.chart); |
| | | Grid.SetRow(this.chart, 2); |
| | | this.chart.MouseDoubleClick += chart_MouseDoubleClick; |
| | |
| | | tcpServer.NewRequestReceived += TcpServer_NewRequestReceived; |
| | | if (!tcpServer.Setup(config.PortStart + index)) |
| | | { |
| | | ChangeTcpServerStatus("ERROR", "服务设置异常"); |
| | | ChangeTcpServerStatus("ERROR", this.lang("Tr.TcpServer.SettingFailed")); |
| | | return; |
| | | } |
| | | if (!tcpServer.Start()) |
| | | { |
| | | ChangeTcpServerStatus("ERROR", "服务启动异常"); |
| | | ChangeTcpServerStatus("ERROR", this.lang("Tr.TcpServer.StartFailed")); |
| | | return; |
| | | } |
| | | ChangeTcpServerStatus("RUNNING", "服务运行中"); |
| | | ChangeTcpServerStatus("RUNNING", this.lang("Tr.TcpServer.Running")); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | ChangeTcpServerStatus("ERROR", $"服务异常:{ex.Message}"); |
| | | ChangeTcpServerStatus("ERROR", $"{ex.Message}"); |
| | | tcpServer?.Stop(); |
| | | tcpServer = null; |
| | | } |