проверка сохранения

This commit is contained in:
klavirshik 2024-08-23 18:00:09 +02:00
parent f493dc1e7a
commit 659f7f12e9
5 changed files with 44 additions and 2 deletions

View File

@ -21,7 +21,7 @@ namespace Reseter2
{
//private FormHistory formHistory;
//System.Windows.Forms.CheckBox
private bool unSave;
private bool FocusContext;
private object selectItem;
public delegate void saveSetting();
@ -473,8 +473,20 @@ namespace Reseter2
{
if (tabControl1.SelectedIndex == 3)
{
unSave = true;
UpdateSetting();
}
else
{
if(unSave && (settingRebootControl1.edited() ||
settingSCCMControl1.edited() ||
settingWordsControl1.edited()))
{
MessageBox.Show("Изменения не сохраненны. Продолжить?");
}
unSave = false;
}
}
private void button2_Click(object sender, EventArgs e)

View File

@ -30,6 +30,7 @@ namespace Reseter2.Setting
}
}
public void Save()
{
SGlobalSetting.settingReboot.checkConnect = (int)nb_checkConnect.Value;
@ -39,6 +40,15 @@ namespace Reseter2.Setting
}
public bool edited()
{
return (SGlobalSetting.settingReboot.checkConnect != (int)nb_checkConnect.Value ||
SGlobalSetting.settingReboot.timeOutReboot != (int)nb_timeOutReboot.Value ||
SGlobalSetting.settingReboot.timeCheckBeforReboot != (int)nb_timeCheckBeforReboot.Value ||
SGlobalSetting.settingReboot.sizeHistoryItem != (int)nb_sizeHistoryItem.Value);
}
}
}

View File

@ -56,6 +56,18 @@ namespace Reseter2.Setting
{
AuthControl(!cb_windowsAuth.Checked);
}
public bool edited()
{
return (SGlobalSetting.settingSCCM.server != ib_server.Text ||
SGlobalSetting.settingSCCM.dataBase != ib_dataBase.Text ||
SGlobalSetting.settingSCCM.username != ib_username.Text ||
SGlobalSetting.settingSCCM.password != ib_password.Text ||
SGlobalSetting.settingSCCM.on != cb_on.Checked ||
SGlobalSetting.settingSCCM.windowsAuth != cb_windowsAuth.Checked);
}
public void Save()
{
SGlobalSetting.settingSCCM.server = ib_server.Text;

View File

@ -52,6 +52,12 @@ namespace Reseter2.Setting
}
}
public bool edited()
{
return (SGlobalSetting.settingWords.PathBase != path.Text);
}
public void Save()
{
if(SGlobalSetting.settingWords.PathBase != path.Text)

View File

@ -38,6 +38,8 @@ namespace Reseter2.Words
return treeNodes;
}
public static TreeNode[] ListNodes(WordsCategory ChangeCategory)
{
TreeNode[] treeNodes = new TreeNode[ChangeCategory.Count()];