| | |
| | | using System.Data; |
| | | using Yw.WinFrmUI; |
| | | using Yw; |
| | | |
| | | namespace IBox.WinFrmUI |
| | | { |
| | | public partial class IBoxFormSystemInfo : DocumentPage |
| | | { |
| | | |
| | | |
| | | public IBoxFormSystemInfo() |
| | | { |
| | | this.PageTitle.Caption = "设备信息"; |
| | |
| | | public event EventHandler<string> SendData; |
| | | private void SendText(string content) |
| | | { |
| | | SendData?.Invoke(null, content); |
| | | if (SendData != null) |
| | | { |
| | | SendData?.Invoke(null, content); |
| | | |
| | | } |
| | | else |
| | | { |
| | | if (IBoxHelper.Ping()) |
| | | { |
| | | var smsg = content.Split(new string[] { IBoxHelper.paramCode, IBoxHelper.startCode }, StringSplitOptions.RemoveEmptyEntries); |
| | | if (smsg.Length < 2) |
| | | { |
| | | return; |
| | | } |
| | | switch (smsg[0].Trim()) |
| | | { |
| | | case IBoxHelper.getstoreCode: |
| | | { |
| | | var order = IBoxHelper.HttpGet(content); |
| | | var result = IBoxHelper.GetContent(order); |
| | | if (!string.IsNullOrEmpty(result)) |
| | | { |
| | | var model = JsonHelper.Json2Object<SystemInfoViewModel>(result); |
| | | BindData(model, false); |
| | | } |
| | | break; |
| | | } |
| | | default: |
| | | IBoxHelper.HttpGet(content); |
| | | break; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | MessageBoxHelper.ShowWarning("网络连接失败,请检查网络"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | textEdit2.Text = model.Wlan0IpAddress.Replace("\n", ""); |
| | | textEdit3.Text = model.SystemVersion; |
| | | textEdit4.Text = model.TotalRunTime; |
| | | textEdit10.Text = model.CurrentTime.Replace(";", ""); |
| | | var dic = GetDuDic(model.Du); |
| | | textEdit5.Text = GetDuString(dic, "/usr/ebox"); |
| | | textEdit6.Text = GetDuString(dic, "/usr/ebox/Data"); |
| | | textEdit7.Text = GetDuString(dic, "/usr/ebox/DataDockingConsole"); |
| | | textEdit8.Text = GetDuString(dic, "/usr/ebox/PostDataConsole"); |
| | | textEdit9.Text = GetDuString(dic, "/usr/ebox/WebServer"); |
| | | try |
| | | { |
| | | textEdit10.Text = model.CurrentTime?.Replace(";", ""); |
| | | var dic = GetDuDic(model.Du); |
| | | if (dic != null) |
| | | { |
| | | textEdit5.Text = GetDuString(dic, "/usr/ebox"); |
| | | textEdit6.Text = GetDuString(dic, "/usr/ebox/Data"); |
| | | textEdit7.Text = GetDuString(dic, "/usr/ebox/DataDockingConsole"); |
| | | textEdit8.Text = GetDuString(dic, "/usr/ebox/PostDataConsole"); |
| | | textEdit9.Text = GetDuString(dic, "/usr/ebox/WebServer"); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | } |
| | | textEdit11.Text = model.MemUse; |
| | | } |
| | | |
| | | private Dictionary<string, string> GetDuDic(string du) |
| | | { |
| | | if (string.IsNullOrEmpty(du)) return null; |
| | | return du.Substring(0, du.Length - 1).Split(';').Select(c => c.Split(':')).ToDictionary(b => b[1], b => b[0]); |
| | | } |
| | | |