Files
CobXml/CobXmlSupport/frmSettings.cs

371 lines
9.9 KiB
C#

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace CobXmlSupport
{
public partial class frmSettings : Form
{
private string UserTmp, CompanyTmp;
private bool tmpChkNoNsRef;
private bool tmpChkUniqueVars;
private bool tmpChkUniqueAttrVars;
private bool tmpChkUnique;
private bool tmpChkWrap;
private bool tmpChkValues;
private bool tmpChkAnaTag;
private bool tmpChkCountVars;
private bool tmpShowTestBtns;
private bool tmpBackupOwnCode;
private string tmpTxtPrefix;
private string tmpTxtExpPrefix;
private string tmpTxtMaxOcc;
private string txtLogVarNameTmp;
private string txtLogVarSectTmp;
//------------
private GenSetting genSet;
// private string aktualFile;
// private string filePath;
private SaverListener sl;
public string AktualFile
{
get
{
return txtActualFile.Text;
}
set
{
txtActualFile.Text = value;
}
}
public string FilePath
{
get
{
return txtFilePath.Text;
}
set
{
txtFilePath.Text = value;
}
}
public GenSetting SettingObj
{
get
{
return genSet;
}
set
{
genSet = value;
}
}
public SaverListener SL
{
get
{
return sl;
}
set
{
sl = value;
}
}
//------------
public frmSettings()
{
InitializeComponent();
}
public string LogPost
{
get
{
return txtLogPost.Text;
}
set
{
txtLogPost.Text = value;
}
}
public string LogSection
{
get
{
return txtLogSection.Text;
}
set
{
txtLogSection.Text = value;
}
}
public string UserName
{
get
{
return txtUserName.Text;
}
set
{
txtUserName.Text = value;
}
}
public string CompanyName
{
get
{
return txtCompanyName.Text;
}
set
{
txtCompanyName.Text = value;
}
}
public bool ChkCountVars
{
get
{
return chkCountVars.Checked;
}
set
{
chkCountVars.Checked = value;
}
}
public bool ChkNoNsRef
{
get
{
return chkNoNsRef.Checked;
}
set
{
chkNoNsRef.Checked = value;
}
}
public bool ChkUniqueVars
{
get
{
return chkUniqueVars.Checked;
}
set
{
chkUniqueVars.Checked = value;
}
}
public bool ChkUniqueAttrVars
{
get
{
return chkUniqueAttrVars.Checked;
}
set
{
chkUniqueAttrVars.Checked = value;
}
}
public bool ChkUnique
{
get
{
return chkUnique.Checked;
}
set
{
chkUnique.Checked = value;
}
}
public bool ChkWrap
{
get
{
return chkWrap.Checked;
}
set
{
chkWrap.Checked = value;
}
}
public bool ChkValues
{
get
{
return chkValues.Checked;
}
set
{
chkValues.Checked = value;
}
}
public bool ChkAnaTag
{
get
{
return chkAnaTag.Checked;
}
set
{
chkAnaTag.Checked = value;
}
}
public bool ChkShowTestbtns
{
get
{
return chkShowTestbtns.Checked;
}
set
{
chkShowTestbtns.Checked = value;
}
}
public bool ChkBackupOwnCode
{
get
{
return chkBackupOwnCode.Checked;
}
set
{
chkBackupOwnCode.Checked = value;
}
}
public string TxtMaxOcc
{
get
{
return txtMaxOcc.Text;
}
set
{
txtMaxOcc.Text = value;
}
}
public string TxtPrefix
{
get
{
return txtPrefix.Text;
}
set
{
txtPrefix.Text = value;
}
}
public string TxtExpPrefix
{
get
{
return txtExpPrefix.Text;
}
set
{
txtExpPrefix.Text = value;
}
}
private void btnSave_Click(object sender, EventArgs e)
{
sl.Subscribe(this.genSet);
S.ettingActualFile = this.AktualFile;
S.ettingFilePath = this.FilePath;
S.ettingAnaTag = Properties.Settings.Default.AnaTag = chkAnaTag.Checked;
S.ettingCountVars = Properties.Settings.Default.CountVars = chkCountVars.Checked;
S.ettingMaxOcc = Properties.Settings.Default.MaxOcc = txtMaxOcc.Text;
S.ettingNoNsRef = Properties.Settings.Default.NoNsRef = chkNoNsRef.Checked;
S.ettingPrefix = Properties.Settings.Default.Prefix = txtPrefix.Text;
S.ettingExpPrefix = Properties.Settings.Default.ExpPrefix = txtExpPrefix.Text;
S.ettingUnique = Properties.Settings.Default.Unique = chkUnique.Checked;
S.ettingUniqueAttrVars = Properties.Settings.Default.UniqueAttrVars = chkUniqueAttrVars.Checked;
S.ettingUniqueVars = Properties.Settings.Default.UniqueVars = chkUniqueVars.Checked;
S.ettingValues = Properties.Settings.Default.Values = chkValues.Checked;
S.ettingWrap = Properties.Settings.Default.Wrap = chkWrap.Checked;
S.ettingSpecials = Properties.Settings.Default.ShowTestbtns = chkShowTestbtns.Checked;
S.ettingBackupOwnCode = Properties.Settings.Default.BackupOwnCode = chkBackupOwnCode.Checked;
S.ettingLogVarName = Properties.Settings.Default.LogVarName = txtLogPost.Text;
S.ettingLogSectName = Properties.Settings.Default.LogSectName = txtLogSection.Text;
S.ettingUserName = Properties.Settings.Default.UserName = txtUserName.Text;
S.ettingCompany = Properties.Settings.Default.CompanyName = txtCompanyName.Text;
Properties.Settings.Default.Save();
this.genSet.GetSettings();
this.sl.UnSubscribe(this.genSet);
this.Close();
}
private void frmSettings_Load(object sender, EventArgs e)
{
this.AktualFile = S.ettingActualFile;
this.FilePath = S.ettingFilePath;
tmpChkAnaTag = chkAnaTag.Checked = S.ettingAnaTag;
tmpChkCountVars = chkCountVars.Checked = S.ettingCountVars;
tmpTxtMaxOcc = txtMaxOcc.Text = S.ettingMaxOcc;
tmpChkNoNsRef = chkNoNsRef.Checked = S.ettingNoNsRef;
tmpTxtPrefix = txtPrefix.Text = S.ettingPrefix;
tmpTxtExpPrefix = txtExpPrefix.Text = S.ettingExpPrefix;
tmpChkUnique = chkUnique.Checked = S.ettingUnique;
tmpChkUniqueAttrVars = chkUniqueAttrVars.Checked = S.ettingUniqueAttrVars;
tmpChkUniqueVars = chkUniqueVars.Checked = S.ettingUniqueVars;
tmpChkValues = chkValues.Checked = S.ettingValues;
tmpChkWrap = chkWrap.Checked = S.ettingWrap;
tmpShowTestBtns = chkShowTestbtns.Checked = S.ettingSpecials;
tmpBackupOwnCode = chkBackupOwnCode.Checked = S.ettingBackupOwnCode;
txtLogVarNameTmp = txtLogPost.Text = S.ettingLogVarName;
txtLogVarSectTmp = txtLogSection.Text = S.ettingLogSectName;
UserTmp = txtUserName.Text = S.ettingUserName;
CompanyTmp = txtCompanyName.Text = S.ettingCompany;
}
private void btnCancel_Click(object sender, EventArgs e)
{
chkAnaTag.Checked = tmpChkAnaTag;
chkCountVars.Checked = tmpChkCountVars;
txtMaxOcc.Text = tmpTxtMaxOcc;
chkNoNsRef.Checked = tmpChkNoNsRef;
txtPrefix.Text = tmpTxtPrefix;
txtExpPrefix.Text = tmpTxtExpPrefix;
chkUnique.Checked = tmpChkUnique;
chkUniqueAttrVars.Checked = tmpChkUniqueAttrVars;
chkUniqueVars.Checked = tmpChkUniqueVars;
chkValues.Checked = tmpChkValues;
chkWrap.Checked = tmpChkWrap;
chkShowTestbtns.Checked = tmpShowTestBtns;
chkBackupOwnCode.Checked = tmpBackupOwnCode;
txtLogPost.Text = txtLogVarNameTmp;
txtLogSection.Text = txtLogVarSectTmp;
txtUserName.Text = UserTmp;
txtCompanyName.Text = CompanyTmp;
this.Close();
}
}
}