Files
CobXml/CobXmlSupport/frmSettings.cs

365 lines
9.3 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;
Properties.Settings.Default.Save();
this.genSet.GetSettings();
this.sl.UnSubscribe(this.genSet);
this.Close();
}
private void frmSettings_Load(object sender, EventArgs e)
{
UserTmp = txtUserName.Text;
CompanyTmp = txtCompanyName.Text;
tmpChkNoNsRef = chkNoNsRef.Checked;
tmpChkUniqueVars = chkUniqueVars.Checked;
tmpChkUniqueAttrVars = chkUniqueAttrVars.Checked;
tmpChkUnique = chkUnique.Checked;
tmpChkWrap = chkWrap.Checked;
tmpChkValues = chkValues.Checked;
tmpChkAnaTag = chkAnaTag.Checked;
tmpShowTestBtns = chkShowTestbtns.Checked;
tmpBackupOwnCode = chkBackupOwnCode.Checked;
tmpTxtPrefix = txtPrefix.Text;
tmpTxtExpPrefix = txtExpPrefix.Text;
tmpTxtMaxOcc = txtMaxOcc.Text;
txtLogVarNameTmp = txtLogPost.Text ;
txtLogVarSectTmp = txtLogSection.Text;
tmpChkCountVars = chkCountVars.Checked;
}
private void btnCancel_Click(object sender, EventArgs e)
{
txtUserName.Text = UserTmp;
txtCompanyName.Text = CompanyTmp;
chkNoNsRef.Checked= tmpChkNoNsRef;
chkUniqueVars.Checked= tmpChkUniqueVars;
chkUniqueAttrVars.Checked= tmpChkUniqueAttrVars ;
chkUnique.Checked= tmpChkUnique;
chkWrap.Checked= tmpChkWrap;
chkValues.Checked= tmpChkValues;
chkAnaTag.Checked= tmpChkAnaTag;
chkShowTestbtns.Checked = tmpShowTestBtns;
chkBackupOwnCode.Checked = tmpBackupOwnCode;
txtPrefix.Text = tmpTxtPrefix;
txtExpPrefix.Text = tmpTxtExpPrefix;
txtMaxOcc.Text = tmpTxtMaxOcc;
txtLogPost.Text= txtLogVarNameTmp;
txtLogSection.Text= txtLogVarSectTmp;
chkCountVars.Checked = tmpChkCountVars;
this.Close();
}
}
}