423 lines
19 KiB
C#
423 lines
19 KiB
C#
using JinYuan.ControlLib;
|
|||
|
|
using JinYuan.Helper;
|
||
|
|
using JinYuan.VirtualDataLibrary;
|
||
|
|
using Microsoft.Win32;
|
||
|
|
using System;
|
||
|
|
using System.IO;
|
||
|
|
using System.Management.Instrumentation;
|
||
|
|
using System.Windows.Forms;
|
||
|
|
|
||
|
|
namespace LargeSquareOne
|
||
|
|
{
|
||
|
|
public partial class FrmSystemSet : Form
|
||
|
|
{
|
||
|
|
/// <summary>
|
||
|
|
/// 打印日志方法
|
||
|
|
/// </summary>
|
||
|
|
/// <param name="Message"></param>日志信息
|
||
|
|
/// <param name="FileName"></param>文件夹名字
|
||
|
|
public static void LogMessage(string Message, string FileName)
|
||
|
|
{
|
||
|
|
string filePath = FileName + "//" + DateTime.Now.ToString("yyyy-MM-dd"); // 日志文件存放路径,默认在debug目录下
|
||
|
|
string filePath2 = FileName + "//" + DateTime.Now.ToString("yyyy-MM-dd") + "//Mylog.txt";//也可以加上时间
|
||
|
|
//string file=DateTime.Now+"log.txt";
|
||
|
|
//检查文件夹是否存在,否则新建
|
||
|
|
if (!Directory.Exists(filePath))
|
||
|
|
{
|
||
|
|
Directory.CreateDirectory(filePath);
|
||
|
|
}
|
||
|
|
string logMessage = $"{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss:fff")}: {Message}";//打印出现的时间
|
||
|
|
// 将消息写入日志文件
|
||
|
|
using (StreamWriter writer = new StreamWriter(filePath2, true))
|
||
|
|
{
|
||
|
|
writer.WriteLine(logMessage);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
public FrmSystemSet(string devPath)
|
||
|
|
{
|
||
|
|
InitializeComponent();
|
||
|
|
|
||
|
|
|
||
|
|
////设置控件样式,去除缓冲
|
||
|
|
this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
|
||
|
|
this.SetStyle(ControlStyles.DoubleBuffer, true);
|
||
|
|
this.SetStyle(ControlStyles.ResizeRedraw, true);
|
||
|
|
this.SetStyle(ControlStyles.Selectable, true);
|
||
|
|
this.SetStyle(ControlStyles.SupportsTransparentBackColor, true);
|
||
|
|
|
||
|
|
this.cmb_PLCType.Items.Add("OmronFinsTcp_HSL");
|
||
|
|
this.cmb_PLCType.Items.Add("Mitsubishi");
|
||
|
|
this.cmb_PLCType.Items.Add("Inovance");
|
||
|
|
|
||
|
|
this.tog_AutoStart.IsChecked = CommonMethods.sysConfig.AutoStart;
|
||
|
|
this.tog_AutoLogin.IsChecked = CommonMethods.sysConfig.AutoLogin;
|
||
|
|
this.tog_AutoLock.IsChecked = CommonMethods.sysConfig.AutoLock;
|
||
|
|
this.up_LockPeriod.CurrentValue = CommonMethods.sysConfig.LockPeriod;
|
||
|
|
this.tog_AutoQieHuanM.IsChecked = CommonMethods.sysConfig.AutoQieHuanM;
|
||
|
|
this.up_QieHuanPeriod.CurrentValue = CommonMethods.sysConfig.QieHuanMPeriod;
|
||
|
|
this.up_ShowSeriesCount.CurrentValue = CommonMethods.sysConfig.ShowSeriesCount;
|
||
|
|
|
||
|
|
this.tog_SwipeCardMode.IsChecked = CommonMethods.sysConfig.SwipeCardMode;
|
||
|
|
this.tog_OpenMesModel.IsChecked = CommonMethods.sysConfig.MesModeSwitching;
|
||
|
|
this.tog_GetMesParam.IsChecked = CommonMethods.sysConfig.GetMesParam;
|
||
|
|
this.tog_SaveThreadTime.IsChecked = CommonMethods.sysConfig.SaveThreadTime;
|
||
|
|
this.tog_OKSwitching.IsChecked = CommonMethods.sysConfig.OKSwitching;
|
||
|
|
this.tog_AutoStart.CheckedChanged += new System.EventHandler(this.tog_AutoStart_CheckedChanged);
|
||
|
|
this.tog_AutoLogin.CheckedChanged += new System.EventHandler(this.tog_AutoLogin_CheckedChanged);
|
||
|
|
this.tog_AutoLock.CheckedChanged += new System.EventHandler(this.tog_AutoLock_CheckedChanged);
|
||
|
|
this.up_LockPeriod.ValueChanged += new System.EventHandler(this.up_LockPeriod_ValueChanged);
|
||
|
|
|
||
|
|
this.tog_AutoQieHuanM.CheckedChanged += new System.EventHandler(this.tog_AutoQieHuanM_CheckedChanged);
|
||
|
|
this.up_QieHuanPeriod.ValueChanged += new System.EventHandler(this.up_QieHuanPeriod_ValueChanged);
|
||
|
|
|
||
|
|
this.up_ShowSeriesCount.ValueChanged += new System.EventHandler(this.up_ShowSeriesCount_ValueChanged);
|
||
|
|
|
||
|
|
this.devPath = devPath;
|
||
|
|
|
||
|
|
InitParam();
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
private string devPath = string.Empty;
|
||
|
|
|
||
|
|
private void InitParam()
|
||
|
|
{
|
||
|
|
this.txt_IP.Text = CommonMethods.plcDevice.IPAddress;
|
||
|
|
this.txt_Prot.Text = CommonMethods.plcDevice.Port.ToString();
|
||
|
|
this.cmb_PLCType.Text = CommonMethods.plcDevice.PLCType;
|
||
|
|
|
||
|
|
this.txtFactory_code.Text = CommonMethods.mesConfig.siteCode;
|
||
|
|
this.txtline_No.Text = CommonMethods.mesConfig.lineCode;
|
||
|
|
this.txtEqp_code.Text = CommonMethods.mesConfig.equipNum;
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
#region 系统相关配置
|
||
|
|
private void tog_AutoLogin_CheckedChanged(object sender, EventArgs e)
|
||
|
|
{
|
||
|
|
if (CommonMethods.SaveAutoLogin(((Toggle)sender).IsChecked))
|
||
|
|
{
|
||
|
|
CommonMethods.AddOPLog(false, "修改软件自动登录方式:" + ((Toggle)sender).IsChecked.ToString());
|
||
|
|
CommonMethods.GetSysConfig();
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
private void tog_AutoStart_CheckedChanged(object sender, EventArgs e)
|
||
|
|
{
|
||
|
|
if (CommonMethods.SaveAutoStart(((Toggle)sender).IsChecked))
|
||
|
|
{
|
||
|
|
//写入注册表
|
||
|
|
AutoStart(((Toggle)sender).IsChecked);
|
||
|
|
CommonMethods.AddOPLog(false, "修改软件自动启动方式:" + ((Toggle)sender).IsChecked.ToString());
|
||
|
|
CommonMethods.GetSysConfig();
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
private void tog_AutoLock_CheckedChanged(object sender, EventArgs e)
|
||
|
|
{
|
||
|
|
if (CommonMethods.SaveAutoLock(((Toggle)sender).IsChecked))
|
||
|
|
{
|
||
|
|
CommonMethods.AddOPLog(false, "修改无操作自动锁屏方式:" + ((Toggle)sender).IsChecked.ToString());
|
||
|
|
CommonMethods.GetSysConfig();
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
private void up_LockPeriod_ValueChanged(object sender, EventArgs e)
|
||
|
|
{
|
||
|
|
if (CommonMethods.SaveLockPeriod(Convert.ToInt32(((UpDownLabel)sender).CurrentValue)))
|
||
|
|
{
|
||
|
|
CommonMethods.AddOPLog(false, "修改锁屏间隔时间:" + ((UpDownLabel)sender).CurrentValue.ToString());
|
||
|
|
CommonMethods.GetSysConfig();
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
private void tog_AutoQieHuanM_CheckedChanged(object sender, EventArgs e)
|
||
|
|
{
|
||
|
|
if (CommonMethods.SaveAutoQieHuanM(((Toggle)sender).IsChecked))
|
||
|
|
{
|
||
|
|
CommonMethods.AddOPLog(false, "修改无操作自动切换监控界面方式:" + ((Toggle)sender).IsChecked.ToString());
|
||
|
|
CommonMethods.GetSysConfig();
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
private void up_QieHuanPeriod_ValueChanged(object sender, EventArgs e)
|
||
|
|
{
|
||
|
|
if (CommonMethods.SaveQieHuanMPeriod(Convert.ToInt32(((UpDownLabel)sender).CurrentValue)))
|
||
|
|
{
|
||
|
|
CommonMethods.AddOPLog(false, "修改切换监控界面间隔时间:" + ((UpDownLabel)sender).CurrentValue.ToString());
|
||
|
|
CommonMethods.GetSysConfig();
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
private void up_ShowSeriesCount_ValueChanged(object sender, EventArgs e)
|
||
|
|
{
|
||
|
|
if (CommonMethods.SaveShowSeriesCount(Convert.ToInt32(((UpDownLabel)sender).CurrentValue)))
|
||
|
|
{
|
||
|
|
CommonMethods.AddOPLog(false, "修改曲线显示数量:" + ((UpDownLabel)sender).CurrentValue.ToString());
|
||
|
|
CommonMethods.GetSysConfig();
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
private void tog_SwipeCardMode_CheckedChanged(object sender, EventArgs e)
|
||
|
|
{
|
||
|
|
if (CommonMethods.SaveSwipeCardMode(((Toggle)sender).IsChecked))
|
||
|
|
{
|
||
|
|
CommonMethods.AddOPLog(false, "修改刷卡模式:" + ((Toggle)sender).IsChecked.ToString());
|
||
|
|
CommonMethods.GetSysConfig();
|
||
|
|
if (CommonMethods.sysConfig.SwipeCardMode && CommonMethods.IsLoginOk)
|
||
|
|
{
|
||
|
|
DialogResult dialogResult1 = new FrmMsgBoxWithAck("当前已登录,是否切换刷卡模式!", "提示").ShowDialog();
|
||
|
|
if (dialogResult1 == DialogResult.OK)
|
||
|
|
{
|
||
|
|
CommonMethods.AddOPLog(false, $"切换刷卡模式成功,当前用户已注销");
|
||
|
|
CommonMethods.IsLoginOk = false;
|
||
|
|
CommonMethods.sysConfig.SwipeCardMode = true;
|
||
|
|
this.tog_SwipeCardMode.IsChecked = CommonMethods.sysConfig.SwipeCardMode;
|
||
|
|
CommonMethods.SaveSwipeCardMode(((Toggle)sender).IsChecked);
|
||
|
|
CommonMethods.GetSysConfig();
|
||
|
|
//切屏
|
||
|
|
CommonMethods.sysConfig.ScreenCutting = true;
|
||
|
|
}
|
||
|
|
else
|
||
|
|
{
|
||
|
|
CommonMethods.IsLoginOk = true;
|
||
|
|
CommonMethods.sysConfig.SwipeCardMode = false;
|
||
|
|
this.tog_SwipeCardMode.IsChecked = CommonMethods.sysConfig.SwipeCardMode;
|
||
|
|
CommonMethods.SaveSwipeCardMode(((Toggle)sender).IsChecked);
|
||
|
|
CommonMethods.GetSysConfig();
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
private void tog_OpenMesModel_CheckedChanged(object sender, EventArgs e)
|
||
|
|
{
|
||
|
|
if (CommonMethods.plcDevice.IsConnected && CommonMethods.sysConfig.MesModeSwitching)
|
||
|
|
{
|
||
|
|
CommonMethods.sysConfig.MesModeSwitching = true;
|
||
|
|
this.tog_OpenMesModel.IsChecked = CommonMethods.sysConfig.MesModeSwitching;
|
||
|
|
CommonMethods.SaveOpenMesModel(((Toggle)sender).IsChecked);
|
||
|
|
CommonMethods.GetSysConfig();
|
||
|
|
new FrmMsgBoxOutWithAck(2, "先停止运行再切换MES", "提示").ShowDialog();
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
if (CommonMethods.plcDevice.IsConnected && !CommonMethods.sysConfig.MesModeSwitching)
|
||
|
|
{
|
||
|
|
CommonMethods.sysConfig.MesModeSwitching = false;
|
||
|
|
this.tog_OpenMesModel.IsChecked = CommonMethods.sysConfig.MesModeSwitching;
|
||
|
|
CommonMethods.SaveOpenMesModel(((Toggle)sender).IsChecked);
|
||
|
|
CommonMethods.GetSysConfig();
|
||
|
|
new FrmMsgBoxOutWithAck(2, "先停止运行再切换MES", "提示").ShowDialog();
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
if (CommonMethods.SaveOpenMesModel(((Toggle)sender).IsChecked))
|
||
|
|
{
|
||
|
|
CommonMethods.AddOPLog(false, "修改MES/非MES模式切换:" + ((Toggle)sender).IsChecked.ToString());
|
||
|
|
CommonMethods.GetSysConfig();
|
||
|
|
if (CommonMethods.sysConfig.MesModeSwitching)
|
||
|
|
{
|
||
|
|
FrmLoginMes frmLoginMes = new FrmLoginMes();
|
||
|
|
if (frmLoginMes.ShowDialog() != DialogResult.OK)
|
||
|
|
{
|
||
|
|
CommonMethods.sysConfig.MesModeSwitching = false;
|
||
|
|
this.tog_OpenMesModel.IsChecked = CommonMethods.sysConfig.MesModeSwitching;
|
||
|
|
CommonMethods.SaveOpenMesModel(((Toggle)sender).IsChecked);
|
||
|
|
CommonMethods.GetSysConfig();
|
||
|
|
}
|
||
|
|
}
|
||
|
|
else
|
||
|
|
{
|
||
|
|
DialogResult dialogResult = new FrmMsgBoxWithAck("是否关闭MES模式!", "提示").ShowDialog();
|
||
|
|
if (dialogResult == DialogResult.OK)
|
||
|
|
{
|
||
|
|
CommonMethods.AddOPLog(false, $"关闭MES模式成功,MES用户已注销");
|
||
|
|
CommonMethods.sysConfig.MesModeSwitching = false;
|
||
|
|
this.tog_OpenMesModel.IsChecked = CommonMethods.sysConfig.MesModeSwitching;
|
||
|
|
CommonMethods.SaveOpenMesModel(((Toggle)sender).IsChecked);
|
||
|
|
CommonMethods.GetSysConfig();
|
||
|
|
}
|
||
|
|
else
|
||
|
|
{
|
||
|
|
CommonMethods.sysConfig.MesModeSwitching = true;
|
||
|
|
this.tog_OpenMesModel.IsChecked = CommonMethods.sysConfig.MesModeSwitching;
|
||
|
|
CommonMethods.SaveOpenMesModel(((Toggle)sender).IsChecked);
|
||
|
|
CommonMethods.GetSysConfig();
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
private void tog_GetMesParam_CheckedChanged(object sender, EventArgs e)
|
||
|
|
{
|
||
|
|
if (CommonMethods.SaveGetMesParam(((Toggle)sender).IsChecked))
|
||
|
|
{
|
||
|
|
CommonMethods.AddOPLog(false, "修改获取MES参数:" + ((Toggle)sender).IsChecked.ToString());
|
||
|
|
CommonMethods.GetSysConfig();
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
private void tog_SaveThreadTime_CheckedChanged(object sender, EventArgs e)
|
||
|
|
{
|
||
|
|
if (CommonMethods.SaveSaveThreadTime(((Toggle)sender).IsChecked))
|
||
|
|
{
|
||
|
|
CommonMethods.AddOPLog(false, "修改线程耗时日志保存:" + ((Toggle)sender).IsChecked.ToString());
|
||
|
|
CommonMethods.GetSysConfig();
|
||
|
|
}
|
||
|
|
}
|
||
|
|
/// <summary>
|
||
|
|
/// 修改程序在注册表的 键值
|
||
|
|
/// </summary>
|
||
|
|
/// <param name="isAuto"></param>
|
||
|
|
private void AutoStart(bool isAuto = true)
|
||
|
|
{
|
||
|
|
if (isAuto == true)
|
||
|
|
{
|
||
|
|
RegistryKey R_local = Registry.CurrentUser;
|
||
|
|
RegistryKey R_run = R_local.CreateSubKey(@"SOFTWARE\Microsoft\windows\CurrentVersion\Run");
|
||
|
|
R_run.SetValue("KYJPro", System.Windows.Forms.Application.ExecutablePath);
|
||
|
|
R_run.Close();
|
||
|
|
R_local.Close();
|
||
|
|
}
|
||
|
|
else
|
||
|
|
{
|
||
|
|
RegistryKey R_local = Registry.CurrentUser;
|
||
|
|
RegistryKey R_run = R_local.CreateSubKey(@"SOFTWARE\Microsoft\windows\CurrentVersion\Run");
|
||
|
|
R_run.DeleteSubKey("KYJPro", false);
|
||
|
|
R_run.Close();
|
||
|
|
R_local.Close();
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
#endregion
|
||
|
|
|
||
|
|
private void btn_GroupConfig_Click(object sender, EventArgs e)
|
||
|
|
{
|
||
|
|
new FrmGroupConfig().ShowDialog();
|
||
|
|
}
|
||
|
|
|
||
|
|
private void btn_VarConfig_Click(object sender, EventArgs e)
|
||
|
|
{
|
||
|
|
new FrmVariableConfig().ShowDialog();
|
||
|
|
}
|
||
|
|
|
||
|
|
private void btn_Sure_Click(object sender, EventArgs e)
|
||
|
|
{
|
||
|
|
bool result = IniConfigHelper.WriteIniData("设备参数", "IP地址", this.txt_IP.Text.Trim(), devPath);
|
||
|
|
IniConfigHelper.WriteIniData("设备参数", "端口号", this.txt_Prot.Text.Trim(), devPath);
|
||
|
|
IniConfigHelper.WriteIniData("设备参数", "PLC类型", this.cmb_PLCType.Text.Trim(), devPath);
|
||
|
|
|
||
|
|
IniConfigHelper.WriteIniData("MES配置", "工厂代码", this.txtFactory_code.Text.Trim());
|
||
|
|
IniConfigHelper.WriteIniData("MES配置", "产线编号", this.txtline_No.Text.Trim());
|
||
|
|
IniConfigHelper.WriteIniData("MES配置", "设备编号", this.txtEqp_code.Text.Trim());
|
||
|
|
|
||
|
|
if (result)
|
||
|
|
{
|
||
|
|
CommonMethods.plcDevice.IPAddress = this.txt_IP.Text.Trim();
|
||
|
|
CommonMethods.plcDevice.Port = Convert.ToInt32(this.txt_Prot.Text.Trim());
|
||
|
|
CommonMethods.plcDevice.PLCType = cmb_PLCType.Text;
|
||
|
|
|
||
|
|
CommonMethods.mesConfig.siteCode = this.txtFactory_code.Text.Trim();
|
||
|
|
CommonMethods.mesConfig.lineCode = this.txtline_No.Text.Trim();
|
||
|
|
CommonMethods.mesConfig.equipNum = this.txtEqp_code.Text.Trim();
|
||
|
|
|
||
|
|
DialogResult dialogResult = new FrmMsgBoxOutWithAck(1, "参数修改成功", "参数设置").ShowDialog();
|
||
|
|
}
|
||
|
|
else
|
||
|
|
{
|
||
|
|
new FrmMsgBoxOutWithAck(3, "通信参数设置失败", "通信设置").Show();
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
/// <summary>
|
||
|
|
/// 取消
|
||
|
|
/// </summary>
|
||
|
|
/// <param name="sender"></param>
|
||
|
|
/// <param name="e"></param>
|
||
|
|
private void btn_Cancel_Click(object sender, EventArgs e)
|
||
|
|
{
|
||
|
|
this.txt_IP.Text = CommonMethods.plcDevice.IPAddress;
|
||
|
|
this.txt_Prot.Text = CommonMethods.plcDevice.Port.ToString();
|
||
|
|
this.cmb_PLCType.Text = CommonMethods.plcDevice.PLCType;
|
||
|
|
|
||
|
|
this.txtFactory_code.Text = CommonMethods.mesConfig.siteCode;
|
||
|
|
this.txtline_No.Text = CommonMethods.mesConfig.lineCode;
|
||
|
|
this.txtEqp_code.Text = CommonMethods.mesConfig.equipNum;
|
||
|
|
}
|
||
|
|
|
||
|
|
#region 减少闪烁
|
||
|
|
protected override CreateParams CreateParams
|
||
|
|
{
|
||
|
|
get
|
||
|
|
{
|
||
|
|
CreateParams cp = base.CreateParams;
|
||
|
|
cp.ExStyle |= 0x02000000;
|
||
|
|
return cp;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
#endregion
|
||
|
|
|
||
|
|
private void tog_OKSwitching_CheckedChanged(object sender, EventArgs e)
|
||
|
|
{
|
||
|
|
|
||
|
|
if (CommonMethods.plcDevice.IsConnected && CommonMethods.sysConfig.OKSwitching)
|
||
|
|
{
|
||
|
|
CommonMethods.sysConfig.OKSwitching = true;
|
||
|
|
this.tog_OKSwitching.IsChecked = CommonMethods.sysConfig.OKSwitching;
|
||
|
|
CommonMethods.SaveOpenOKModel(((Toggle)sender).IsChecked);
|
||
|
|
CommonMethods.GetSysConfig();
|
||
|
|
new FrmMsgBoxOutWithAck(2, "先停止运行再切换强制OK模式", "提示").ShowDialog();
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
if (CommonMethods.plcDevice.IsConnected && !CommonMethods.sysConfig.OKSwitching)
|
||
|
|
{
|
||
|
|
CommonMethods.sysConfig.OKSwitching = false;
|
||
|
|
this.tog_OKSwitching.IsChecked = CommonMethods.sysConfig.OKSwitching;
|
||
|
|
CommonMethods.SaveOpenOKModel(((Toggle)sender).IsChecked);
|
||
|
|
CommonMethods.GetSysConfig();
|
||
|
|
new FrmMsgBoxOutWithAck(2, "先停止运行再切换强制OK模式", "提示").ShowDialog();
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
if (CommonMethods.SaveOpenOKModel(((Toggle)sender).IsChecked))
|
||
|
|
{
|
||
|
|
CommonMethods.AddOPLog(false, "强制OK/正常NG模式切换:" + ((Toggle)sender).IsChecked.ToString());
|
||
|
|
CommonMethods.GetSysConfig();
|
||
|
|
if (CommonMethods.sysConfig.OKSwitching)
|
||
|
|
{
|
||
|
|
CommonMethods.sysConfig.OKSwitching = true;
|
||
|
|
this.tog_OKSwitching.IsChecked = CommonMethods.sysConfig.OKSwitching;
|
||
|
|
CommonMethods.SaveOpenOKModel(((Toggle)sender).IsChecked);
|
||
|
|
CommonMethods.GetSysConfig();
|
||
|
|
}
|
||
|
|
else
|
||
|
|
{
|
||
|
|
DialogResult dialogResult = new FrmMsgBoxWithAck("是否关闭强制OK模式!", "提示").ShowDialog();
|
||
|
|
if (dialogResult == DialogResult.OK)
|
||
|
|
{
|
||
|
|
CommonMethods.AddOPLog(false, $"关闭强制OK模式成功");
|
||
|
|
CommonMethods.sysConfig.OKSwitching = false;
|
||
|
|
this.tog_OKSwitching.IsChecked = CommonMethods.sysConfig.OKSwitching;
|
||
|
|
CommonMethods.SaveOpenOKModel(((Toggle)sender).IsChecked);
|
||
|
|
CommonMethods.GetSysConfig();
|
||
|
|
}
|
||
|
|
else
|
||
|
|
{
|
||
|
|
CommonMethods.sysConfig.OKSwitching = true;
|
||
|
|
this.tog_OKSwitching.IsChecked = CommonMethods.sysConfig.OKSwitching;
|
||
|
|
CommonMethods.SaveOpenOKModel(((Toggle)sender).IsChecked);
|
||
|
|
CommonMethods.GetSysConfig();
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
string OKMessage = "调用了强制结果开关,当前状态(true:启用,false:未启用)为: " + CommonMethods.sysConfig.OKSwitching.ToString();
|
||
|
|
LogMessage(OKMessage, "强制结果OK日志");
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|