Commit 3803bfa9 by zxw

通道监管模式

parent 96779470
......@@ -105,5 +105,6 @@ namespace JmpCommon
public bool IsPushShelfPrint { get; set; }
public int PushShelfPrintType { get; set; }
public string PushShelfPrintCom { get; set; }
public bool IsEnableMonitorMode { get; set; }
}
}
......@@ -52,6 +52,9 @@ namespace JmpServiceMgr
this.txtDomain = new DevComponents.DotNetBar.Controls.TextBoxX();
this.label10 = new System.Windows.Forms.Label();
this.groupBox5 = new System.Windows.Forms.GroupBox();
this.lb_shelfPrintType = new System.Windows.Forms.Label();
this.lb_shelfPrintCom = new System.Windows.Forms.Label();
this.cbb_shelfPrintType = new System.Windows.Forms.ComboBox();
this.chk_syncCard = new DevComponents.DotNetBar.Controls.CheckBoxX();
this.cbb_shelfPrintCom = new System.Windows.Forms.ComboBox();
this.chk_pushShelfPrint = new DevComponents.DotNetBar.Controls.CheckBoxX();
......@@ -70,9 +73,7 @@ namespace JmpServiceMgr
this.superTabItem2 = new DevComponents.DotNetBar.SuperTabItem();
this.superTabControlPanel1 = new DevComponents.DotNetBar.SuperTabControlPanel();
this.superTabItem1 = new DevComponents.DotNetBar.SuperTabItem();
this.cbb_shelfPrintType = new System.Windows.Forms.ComboBox();
this.lb_shelfPrintCom = new System.Windows.Forms.Label();
this.lb_shelfPrintType = new System.Windows.Forms.Label();
this.chkMonitorMode = new DevComponents.DotNetBar.Controls.CheckBoxX();
this.groupBox4.SuspendLayout();
this.groupBox5.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.superTabControl1)).BeginInit();
......@@ -357,6 +358,7 @@ namespace JmpServiceMgr
// groupBox5
//
this.groupBox5.BackColor = System.Drawing.Color.White;
this.groupBox5.Controls.Add(this.chkMonitorMode);
this.groupBox5.Controls.Add(this.lb_shelfPrintType);
this.groupBox5.Controls.Add(this.lb_shelfPrintCom);
this.groupBox5.Controls.Add(this.cbb_shelfPrintType);
......@@ -380,6 +382,39 @@ namespace JmpServiceMgr
this.groupBox5.TabStop = false;
this.groupBox5.Text = "其他设置";
//
// lb_shelfPrintType
//
this.lb_shelfPrintType.AutoSize = true;
this.lb_shelfPrintType.Location = new System.Drawing.Point(26, 343);
this.lb_shelfPrintType.Name = "lb_shelfPrintType";
this.lb_shelfPrintType.Size = new System.Drawing.Size(75, 15);
this.lb_shelfPrintType.TabIndex = 28;
this.lb_shelfPrintType.Text = "接入类型:";
//
// lb_shelfPrintCom
//
this.lb_shelfPrintCom.AutoSize = true;
this.lb_shelfPrintCom.Location = new System.Drawing.Point(198, 343);
this.lb_shelfPrintCom.Name = "lb_shelfPrintCom";
this.lb_shelfPrintCom.Size = new System.Drawing.Size(39, 15);
this.lb_shelfPrintCom.TabIndex = 27;
this.lb_shelfPrintCom.Text = "COM:";
//
// cbb_shelfPrintType
//
this.cbb_shelfPrintType.BackColor = System.Drawing.Color.White;
this.cbb_shelfPrintType.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cbb_shelfPrintType.ForeColor = System.Drawing.Color.Black;
this.cbb_shelfPrintType.FormattingEnabled = true;
this.cbb_shelfPrintType.Items.AddRange(new object[] {
"COM",
"MQTT"});
this.cbb_shelfPrintType.Location = new System.Drawing.Point(107, 340);
this.cbb_shelfPrintType.Name = "cbb_shelfPrintType";
this.cbb_shelfPrintType.Size = new System.Drawing.Size(56, 23);
this.cbb_shelfPrintType.TabIndex = 26;
this.cbb_shelfPrintType.SelectedIndexChanged += new System.EventHandler(this.cbb_shelfPrintType_SelectedIndexChanged);
//
// chk_syncCard
//
this.chk_syncCard.BackColor = System.Drawing.Color.White;
......@@ -660,38 +695,20 @@ namespace JmpServiceMgr
this.superTabItem1.Name = "superTabItem1";
this.superTabItem1.Text = "superTabItem1";
//
// cbb_shelfPrintType
// chkMonitorMode
//
this.cbb_shelfPrintType.BackColor = System.Drawing.Color.White;
this.cbb_shelfPrintType.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cbb_shelfPrintType.ForeColor = System.Drawing.Color.Black;
this.cbb_shelfPrintType.FormattingEnabled = true;
this.cbb_shelfPrintType.Items.AddRange(new object[] {
"COM",
"MQTT"});
this.cbb_shelfPrintType.Location = new System.Drawing.Point(107, 340);
this.cbb_shelfPrintType.Name = "cbb_shelfPrintType";
this.cbb_shelfPrintType.Size = new System.Drawing.Size(56, 23);
this.cbb_shelfPrintType.TabIndex = 26;
this.cbb_shelfPrintType.SelectedIndexChanged += new System.EventHandler(this.cbb_shelfPrintType_SelectedIndexChanged);
//
// lb_shelfPrintCom
this.chkMonitorMode.BackColor = System.Drawing.Color.White;
//
this.lb_shelfPrintCom.AutoSize = true;
this.lb_shelfPrintCom.Location = new System.Drawing.Point(198, 343);
this.lb_shelfPrintCom.Name = "lb_shelfPrintCom";
this.lb_shelfPrintCom.Size = new System.Drawing.Size(39, 15);
this.lb_shelfPrintCom.TabIndex = 27;
this.lb_shelfPrintCom.Text = "COM:";
//
// lb_shelfPrintType
//
this.lb_shelfPrintType.AutoSize = true;
this.lb_shelfPrintType.Location = new System.Drawing.Point(26, 343);
this.lb_shelfPrintType.Name = "lb_shelfPrintType";
this.lb_shelfPrintType.Size = new System.Drawing.Size(75, 15);
this.lb_shelfPrintType.TabIndex = 28;
this.lb_shelfPrintType.Text = "接入类型:";
this.chkMonitorMode.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square;
this.chkMonitorMode.ForeColor = System.Drawing.Color.Black;
this.chkMonitorMode.Location = new System.Drawing.Point(177, 39);
this.chkMonitorMode.Name = "chkMonitorMode";
this.chkMonitorMode.Size = new System.Drawing.Size(122, 23);
this.chkMonitorMode.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.chkMonitorMode.TabIndex = 29;
this.chkMonitorMode.Text = "启用监管模式";
//
// FrmConfig
//
......@@ -770,5 +787,6 @@ namespace JmpServiceMgr
private System.Windows.Forms.Label lb_shelfPrintCom;
private System.Windows.Forms.ComboBox cbb_shelfPrintType;
private System.Windows.Forms.Label lb_shelfPrintType;
private DevComponents.DotNetBar.Controls.CheckBoxX chkMonitorMode;
}
}
\ No newline at end of file
......@@ -209,6 +209,8 @@ namespace JmpServiceMgr
lb_shelfPrintCom.Enabled = false;
cbb_shelfPrintCom.Enabled = false;
}
chkMonitorMode.Checked = MyCache.SysConfig.IsEnableMonitorMode;
}
private void btnColse_Click(object sender, EventArgs e)
{
......@@ -340,6 +342,8 @@ namespace JmpServiceMgr
MyCache.SysConfig.PushShelfPrintCom = "";
}
MyCache.SysConfig.IsEnableMonitorMode = chkMonitorMode.Checked;
MyCache.SetSystemSetp();
//settings.Save(System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase + "settings.xml");
MessageBoxEx.Show(this, "配置保存成功,软件重启后生效!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
......
......@@ -28,6 +28,8 @@ using System.Web;
using System.Windows.Forms;
using JmpServiceMgr.Helper;
using MQTTnet.Client;
using System.Collections;
using DevComponents.DotNetBar.Controls;
namespace JmpServiceMgr
{
......@@ -80,7 +82,14 @@ namespace JmpServiceMgr
notifyIcon.Text = MyCache.SysConfig?.AppTitle ?? "通道服务";
//winHwnd = this.Handle;
_unique = $"TD{MachineIdentity.GetFileIdentity()}";
SetLogs("初始化管理程序");
if (MyCache.SysConfig?.IsEnableMonitorMode == true)
{
SetLogs("初始化管理程序:监管模式");
}
else
{
SetLogs("初始化管理程序");
}
SetLogs(_unique);
if (MyCache.SysConfig != null)
......@@ -143,18 +152,39 @@ namespace JmpServiceMgr
}
}
public void SetLogs(string msg)
public void SetLogs(string msg, Color color = default)
{
if (color == default)
{
color = Color.Black;
}
this.Invoke((Action)delegate
{
if (txt_log.Text.Length > 30000)
{
txt_log.ResetText();
}
txt_log.Text = txt_log.Text.Insert(0, $"{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff")} - {msg}\r\n");
var txt = $"{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff")} - {msg}\r\n";
//txt_log.Text = txt_log.Text.Insert(0, txt);
AppendTextColorful(txt_log, txt, color, false);
});
Application.DoEvents();
}
private void AppendTextColorful(RichTextBox rtBox, string text, Color color, bool addNewLine)
{
if (addNewLine)
{
text += Environment.NewLine;
}
rtBox.SelectionStart = rtBox.TextLength;
rtBox.SelectionLength = 0;
rtBox.SelectionColor = color;
rtBox.AppendText(text);
rtBox.SelectionColor = rtBox.ForeColor;
}
private void notifyIcon_MouseDoubleClick(object sender, MouseEventArgs e)
{
this.Show();
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论