Files
KJD/TEMUKJD/KJDForms/SystemForms/SystemViolationDetectionForm.cs
2026-11-02 17:17:44 +08:00

44 lines
1.5 KiB
C#

using System;
using AllBase.Helper;
using TemuKJD.BaseForms;
namespace TemuKJD.KJDForms.SystemForms
{
public partial class SystemViolationDetectionForm : BaseForm
{
public SystemViolationDetectionForm()
{
InitializeComponent();
VisibleChanged += (s, e) => { if (Visible) LoadSettings(); };
LoadSettings();
chkAutoReport.CheckedChanged += Settings_CheckedChanged;
chkAutoExcludeOnUpload.CheckedChanged += Settings_CheckedChanged;
chkAutoDelist.CheckedChanged += Settings_CheckedChanged;
}
private bool loading;
private void LoadSettings()
{
loading = true;
var settings = GlobalConfig.GlobalSettings;
chkAutoReport.Checked = settings.AutoReportViolationProducts;
chkAutoExcludeOnUpload.Checked = settings.AutoExcludeViolationProductsOnUpload;
chkAutoDelist.Checked = settings.AutoDelistViolationProducts;
loading = false;
}
private void Settings_CheckedChanged(object sender, EventArgs e)
{
if (loading) return;
var settings = GlobalConfig.GlobalSettings;
settings.AutoReportViolationProducts = chkAutoReport.Checked;
settings.AutoExcludeViolationProductsOnUpload = chkAutoExcludeOnUpload.Checked;
settings.AutoDelistViolationProducts = chkAutoDelist.Checked;
StartUp.SaveGlobalSettings();
}
}
}