44 lines
1.5 KiB
C#
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();
|
|
}
|
|
}
|
|
}
|