Completed the S.ettings object with some more fields and checked the use of them

This commit is contained in:
2015-07-16 20:40:34 +02:00
parent 92c5165035
commit 125709f4ff
5 changed files with 122 additions and 147 deletions

View File

@ -271,6 +271,7 @@
this.txtMaxOcc.TabIndex = 18; this.txtMaxOcc.TabIndex = 18;
this.txtMaxOcc.Text = "25"; this.txtMaxOcc.Text = "25";
this.txtMaxOcc.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; this.txtMaxOcc.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
this.txtMaxOcc.TextChanged += new System.EventHandler(this.txtMaxOcc_TextChanged);
// //
// chkUniqueAttrVars // chkUniqueAttrVars
// //

View File

@ -735,6 +735,7 @@ namespace CobXmlSupport
private void Form1_Load(object sender, EventArgs e) private void Form1_Load(object sender, EventArgs e)
{ {
formLoading = true; formLoading = true;
chkValues.Checked = true; chkValues.Checked = true;
chkUnique.Checked = true; chkUnique.Checked = true;
chkAnaTag.Checked = true; chkAnaTag.Checked = true;
@ -765,8 +766,6 @@ namespace CobXmlSupport
S.ettingUserName = Properties.Settings.Default.UserName; S.ettingUserName = Properties.Settings.Default.UserName;
S.ettingCompany = Properties.Settings.Default.CompanyName; S.ettingCompany = Properties.Settings.Default.CompanyName;
S.ettingAnaTag = Properties.Settings.Default.AnaTag; S.ettingAnaTag = Properties.Settings.Default.AnaTag;
S.ettingCountVars = Properties.Settings.Default.CountVars; S.ettingCountVars = Properties.Settings.Default.CountVars;
S.ettingMaxOcc = Properties.Settings.Default.MaxOcc; S.ettingMaxOcc = Properties.Settings.Default.MaxOcc;
@ -780,7 +779,7 @@ namespace CobXmlSupport
S.ettingWrap = Properties.Settings.Default.Wrap; S.ettingWrap = Properties.Settings.Default.Wrap;
S.ettingLogVarName = Properties.Settings.Default.LogVarName; S.ettingLogVarName = Properties.Settings.Default.LogVarName;
S.ettingLogSectName = Properties.Settings.Default.LogSectName; S.ettingLogSectName = Properties.Settings.Default.LogSectName;
S.ettingSpecials = Properties.Settings.Default.ShowTestbtns; S.ettingShowTestbtns = Properties.Settings.Default.ShowTestbtns;
chkAnaTag.Checked = S.ettingAnaTag; chkAnaTag.Checked = S.ettingAnaTag;
chkCountVars.Checked = S.ettingCountVars; chkCountVars.Checked = S.ettingCountVars;
@ -794,7 +793,7 @@ namespace CobXmlSupport
chkUniqueVars.Checked = S.ettingUniqueVars; chkUniqueVars.Checked = S.ettingUniqueVars;
chkValues.Checked = S.ettingValues; chkValues.Checked = S.ettingValues;
chkWrap.Checked = S.ettingWrap; chkWrap.Checked = S.ettingWrap;
btnTestThings.Visible = S.ettingSpecials; btnTestThings.Visible = S.ettingShowTestbtns;
formLoading = false; formLoading = false;
// cmbLastFile.Text = cmbLastFile.Items[0].ToString(); // cmbLastFile.Text = cmbLastFile.Items[0].ToString();
@ -1180,6 +1179,22 @@ namespace CobXmlSupport
private void cmbLastFile_SelectedIndexChanged(object sender, EventArgs e) private void cmbLastFile_SelectedIndexChanged(object sender, EventArgs e)
{ {
if ( S.ettingActualFile != null)
{
GenSetting tmpSetting = new GenSetting();
this.sl.Subscribe(tmpSetting);
tmpSetting.GetSettings();
this.sl.UnSubscribe(tmpSetting);
}
S.ettingActualFile = cmbLastFile.Text.Substring(cmbLastFile.Text.LastIndexOf("\\") + 1);
GenSetting tmpGS = null;
sl.dict.TryGetValue(S.ettingActualFile, out tmpGS);
if (tmpGS != null)
{
tmpGS.SetSettings();
setLocalValues();
}
runXMLgen(); runXMLgen();
} }
@ -1295,66 +1310,10 @@ namespace CobXmlSupport
eventRun = true; eventRun = true;
//setWindow.UserName = S.ettingUserName;
//setWindow.CompanyName = S.ettingCompany;
//setWindow.AktualFile = S.ettingActualFile;
//setWindow.FilePath = S.ettingFilePath;
//setWindow.ChkNoNsRef = S.ettingNoNsRef;
//setWindow.ChkUniqueVars = S.ettingUniqueVars;
//setWindow.ChkUniqueAttrVars = S.ettingUniqueAttrVars;
//setWindow.ChkUnique = S.ettingUnique;
//setWindow.ChkWrap = S.ettingWrap;
//setWindow.ChkValues = S.ettingValues;
//setWindow.ChkAnaTag = S.ettingAnaTag;
//setWindow.TxtPrefix = S.ettingPrefix;
//setWindow.TxtExpPrefix = S.ettingExpPrefix;
//setWindow.TxtMaxOcc = S.ettingMaxOcc;
//setWindow.ChkCountVars = S.ettingCountVars;
//setWindow.LogPost = S.ettingLogVarName;
//setWindow.LogSection = S.ettingLogSectName;
//setWindow.ChkShowTestbtns = S.ettingSpecials;
//setWindow.ChkBackupOwnCode = S.ettingUserCodeBcup;
setWindow.ShowDialog(); setWindow.ShowDialog();
//S.ettingUserName = setWindow.UserName;
//S.ettingCompany = setWindow.CompanyName;
//S.ettingNoNsRef = setWindow.ChkNoNsRef;
//S.ettingUniqueVars = setWindow.ChkUniqueVars;
//S.ettingUniqueAttrVars = setWindow.ChkUniqueAttrVars;
//S.ettingUnique = setWindow.ChkUnique;
//S.ettingWrap = setWindow.ChkWrap;
//S.ettingValues = setWindow.ChkValues;
//S.ettingAnaTag = setWindow.ChkAnaTag;
//S.ettingPrefix = setWindow.TxtPrefix;
//S.ettingExpPrefix = setWindow.TxtExpPrefix;
//S.ettingMaxOcc = setWindow.TxtMaxOcc;
//S.ettingCountVars = setWindow.ChkCountVars;
//S.ettingLogVarName = setWindow.LogPost;
//S.ettingLogSectName = setWindow.LogSection;
//S.ettingSpecials = setWindow.ChkShowTestbtns;
//S.ettingUserCodeBcup = setWindow.ChkBackupOwnCode;
setLocalValues(); setLocalValues();
//chkAnaTag.Checked = S.ettingAnaTag;
//chkCountVars.Checked = S.ettingCountVars;
//chkDisplays.Checked = true;
//chkNoNsRef.Checked = S.ettingNoNsRef;
//chkUnique.Checked = S.ettingUnique;
//chkUniqueAttrVars.Checked = S.ettingUniqueAttrVars;
//chkUniqueVars.Checked = S.ettingUniqueVars;
//chkValues.Checked = S.ettingValues;
//chkWrap.Checked = S.ettingWrap;
//txtMaxOcc.Text = S.ettingMaxOcc;
//txtPrefix.Text = S.ettingPrefix;
//txtExpPrefix.Text = S.ettingExpPrefix;
//btnTestThings.Visible = S.ettingSpecials;
//chkBackupVars.Checked = S.ettingUserCodeBcup;
eventRun = false; eventRun = false;
runXMLgen(); runXMLgen();
} }
@ -1362,20 +1321,32 @@ namespace CobXmlSupport
private void setLocalValues() private void setLocalValues()
{ {
eventRun = true; eventRun = true;
chkAnaTag.Checked = S.ettingAnaTag; chkAnaTag.Checked = S.ettingAnaTag; chkAnaTag.Refresh();
chkCountVars.Checked = S.ettingCountVars; chkCountVars.Checked = S.ettingCountVars; chkCountVars.Refresh();
chkDisplays.Checked = true; chkDisplays.Checked = S.ettingDisplays;
chkDisplays.Refresh();
chkNoNsRef.Checked = S.ettingNoNsRef; chkNoNsRef.Checked = S.ettingNoNsRef;
chkNoNsRef.Refresh();
chkUnique.Checked = S.ettingUnique; chkUnique.Checked = S.ettingUnique;
chkUnique.Refresh();
chkUniqueAttrVars.Checked = S.ettingUniqueAttrVars; chkUniqueAttrVars.Checked = S.ettingUniqueAttrVars;
chkUniqueAttrVars.Refresh();
chkUniqueVars.Checked = S.ettingUniqueVars; chkUniqueVars.Checked = S.ettingUniqueVars;
chkUniqueVars.Refresh();
chkValues.Checked = S.ettingValues; chkValues.Checked = S.ettingValues;
chkValues.Refresh();
chkWrap.Checked = S.ettingWrap; chkWrap.Checked = S.ettingWrap;
chkWrap.Refresh();
txtMaxOcc.Text = S.ettingMaxOcc; txtMaxOcc.Text = S.ettingMaxOcc;
txtMaxOcc.Refresh();
txtPrefix.Text = S.ettingPrefix; txtPrefix.Text = S.ettingPrefix;
txtPrefix.Refresh();
txtExpPrefix.Text = S.ettingExpPrefix; txtExpPrefix.Text = S.ettingExpPrefix;
btnTestThings.Visible = S.ettingSpecials; txtExpPrefix.Refresh();
btnTestThings.Visible = S.ettingShowTestbtns;
btnTestThings.Refresh();
chkBackupVars.Checked = S.ettingUserCodeBcup; chkBackupVars.Checked = S.ettingUserCodeBcup;
chkBackupVars.Refresh();
eventRun = false; eventRun = false;
} }
@ -2298,6 +2269,10 @@ namespace CobXmlSupport
S.ettingExpPrefix = txtExpPrefix.Text; S.ettingExpPrefix = txtExpPrefix.Text;
} }
private void txtMaxOcc_TextChanged(object sender, EventArgs e)
{
S.ettingMaxOcc = txtMaxOcc.Text;
}
} }
} }

View File

@ -6,57 +6,57 @@ using System.Threading.Tasks;
namespace CobXmlSupport namespace CobXmlSupport
{ {
public class GenSetting:ICloneable public class GenSetting : ICloneable
{ {
public event SaveHandler evSave; public event SaveHandler evSave;
public EventArgs e = null; public EventArgs e = null;
public delegate void SaveHandler(GenSetting G, EventArgs e); public delegate void SaveHandler(GenSetting G, EventArgs e);
public string ActualFile { get; set; } public string ActualFile { get; set; }
public string FilePath { get; set; }
public string UserName { get; set; }
public string Company { get; set; }
public bool NoNsRef { get; set; }
public bool UniqueVars { get; set; }
public bool UniqueAttrVars { get; set; }
public bool Unique { get; set; }
public bool Wrap { get; set; }
public bool Values { get; set; }
public bool AnaTag { get; set; } public bool AnaTag { get; set; }
public string Prefix { get; set; }
public string ExpPrefix { get; set; }
public string MaxOcc { get; set; }
public bool CountVars { get; set; }
public string LogVarName { get; set; }
public string LogSectName { get; set; }
public bool Specials { get; set; }
public bool UserCodeBcup { get; set; }
public bool BcupOwnCode { get; set; } public bool BcupOwnCode { get; set; }
public string Company { get; set; }
public bool CountVars { get; set; }
public bool Displays { get; set; }
public string ExpPrefix { get; set; }
public string FilePath { get; set; }
public string LogSectName { get; set; }
public string LogVarName { get; set; }
public string MaxOcc { get; set; }
public bool NoNsRef { get; set; }
public string Prefix { get; set; }
public bool Unique { get; set; }
public bool UniqueAttrVars { get; set; }
public bool UniqueVars { get; set; }
public bool UserCodeBcup { get; set; }
public string UserName { get; set; }
public bool Values { get; set; }
public bool Wrap { get; set; }
public bool ShowTestbtns { get; set; }
public void GetSettings() public void GetSettings()
{ {
this.ActualFile = S.ettingActualFile; this.ActualFile = S.ettingActualFile;
this.FilePath = S.ettingFilePath;
this.UserName = S.ettingUserName;
this.Company = S.ettingCompany;
this.NoNsRef = S.ettingNoNsRef;
this.UniqueVars = S.ettingUniqueVars;
this.UniqueAttrVars = S.ettingUniqueAttrVars;
this.Unique = S.ettingUnique;
this.Wrap = S.ettingWrap;
this.Values = S.ettingValues;
this.AnaTag = S.ettingAnaTag; this.AnaTag = S.ettingAnaTag;
this.Prefix = S.ettingPrefix;
this.ExpPrefix = S.ettingExpPrefix;
this.MaxOcc = S.ettingMaxOcc;
this.CountVars = S.ettingCountVars;
this.LogVarName = S.ettingLogVarName;
this.LogSectName = S.ettingLogSectName;
this.Specials = S.ettingSpecials;
this.UserCodeBcup = S.ettingUserCodeBcup;
this.BcupOwnCode = S.ettingBackupOwnCode; this.BcupOwnCode = S.ettingBackupOwnCode;
this.Company = S.ettingCompany;
this.CountVars = S.ettingCountVars;
this.Displays = S.ettingDisplays;
this.ExpPrefix = S.ettingExpPrefix;
this.FilePath = S.ettingFilePath;
this.LogSectName = S.ettingLogSectName;
this.LogVarName = S.ettingLogVarName;
this.MaxOcc = S.ettingMaxOcc;
this.NoNsRef = S.ettingNoNsRef;
this.Prefix = S.ettingPrefix;
this.Unique = S.ettingUnique;
this.UniqueAttrVars = S.ettingUniqueAttrVars;
this.UniqueVars = S.ettingUniqueVars;
this.UserCodeBcup = S.ettingUserCodeBcup;
this.UserName = S.ettingUserName;
this.Values = S.ettingValues;
this.Wrap = S.ettingWrap;
this.ShowTestbtns = S.ettingShowTestbtns;
if (evSave != null) if (evSave != null)
{ {
@ -66,27 +66,29 @@ namespace CobXmlSupport
public void SetSettings() public void SetSettings()
{ {
S.ettingActualFile =this.ActualFile ;
S.ettingFilePath = this.FilePath;
S.ettingUserName = this.UserName; S.ettingActualFile = this.ActualFile;
S.ettingCompany = this.Company;
S.ettingNoNsRef = this.NoNsRef;
S.ettingUniqueVars = this.UniqueVars;
S.ettingUniqueAttrVars = this.UniqueAttrVars;
S.ettingUnique = this.Unique;
S.ettingWrap = this.Wrap;
S.ettingValues = this.Values;
S.ettingAnaTag = this.AnaTag; S.ettingAnaTag = this.AnaTag;
S.ettingPrefix = this.Prefix;
S.ettingExpPrefix = this.ExpPrefix;
S.ettingMaxOcc = this.MaxOcc;
S.ettingCountVars = this.CountVars;
S.ettingLogVarName = this.LogVarName;
S.ettingLogSectName = this.LogSectName;
S.ettingSpecials = this.Specials;
S.ettingUserCodeBcup = this.UserCodeBcup;
S.ettingBackupOwnCode = this.BcupOwnCode; S.ettingBackupOwnCode = this.BcupOwnCode;
S.ettingCompany = this.Company;
S.ettingCountVars = this.CountVars;
S.ettingDisplays = this.Displays;
S.ettingExpPrefix = this.ExpPrefix;
S.ettingFilePath = this.FilePath;
S.ettingLogSectName = this.LogSectName;
S.ettingLogVarName = this.LogVarName;
S.ettingMaxOcc = this.MaxOcc;
S.ettingNoNsRef = this.NoNsRef;
S.ettingPrefix = this.Prefix;
S.ettingUnique = this.Unique;
S.ettingUniqueAttrVars = this.UniqueAttrVars;
S.ettingUniqueVars = this.UniqueVars;
S.ettingUserCodeBcup = this.UserCodeBcup;
S.ettingUserName = this.UserName;
S.ettingValues = this.Values;
S.ettingWrap = this.Wrap;
S.ettingShowTestbtns = this.ShowTestbtns;
} }
public object Clone() public object Clone()

View File

@ -9,29 +9,26 @@ namespace CobXmlSupport
{ {
public static class S public static class S
{ {
public static string ettingUserName;
public static string ettingCompany;
public static bool ettingNoNsRef;
public static bool ettingUniqueVars;
public static bool ettingUniqueAttrVars;
public static bool ettingUnique;
public static bool ettingWrap;
public static bool ettingValues;
public static bool ettingAnaTag;
public static string ettingPrefix;
public static string ettingExpPrefix;
public static string ettingMaxOcc;
public static bool ettingCountVars;
public static string ettingLogVarName;
public static string ettingLogSectName;
public static bool ettingSpecials;
public static bool ettingUserCodeBcup;
//-------------------------
// public static bool ettingShowTestbtns;
//-------------------------
public static bool ettingBackupOwnCode;
public static string ettingActualFile; public static string ettingActualFile;
public static bool ettingAnaTag;
public static bool ettingBackupOwnCode;
public static string ettingCompany;
public static bool ettingCountVars;
public static bool ettingDisplays;
public static string ettingExpPrefix;
public static string ettingFilePath; public static string ettingFilePath;
//------------------------- public static string ettingLogSectName;
public static string ettingLogVarName;
public static string ettingMaxOcc;
public static bool ettingNoNsRef;
public static string ettingPrefix;
public static bool ettingUnique;
public static bool ettingUniqueAttrVars;
public static bool ettingUniqueVars;
public static bool ettingUserCodeBcup;
public static string ettingUserName;
public static bool ettingValues;
public static bool ettingWrap;
public static bool ettingShowTestbtns;
} }
} }

View File

@ -304,7 +304,7 @@ namespace CobXmlSupport
S.ettingUniqueVars = Properties.Settings.Default.UniqueVars = chkUniqueVars.Checked; S.ettingUniqueVars = Properties.Settings.Default.UniqueVars = chkUniqueVars.Checked;
S.ettingValues = Properties.Settings.Default.Values = chkValues.Checked; S.ettingValues = Properties.Settings.Default.Values = chkValues.Checked;
S.ettingWrap = Properties.Settings.Default.Wrap = chkWrap.Checked; S.ettingWrap = Properties.Settings.Default.Wrap = chkWrap.Checked;
S.ettingSpecials = Properties.Settings.Default.ShowTestbtns = chkShowTestbtns.Checked; S.ettingShowTestbtns = Properties.Settings.Default.ShowTestbtns = chkShowTestbtns.Checked;
S.ettingBackupOwnCode = Properties.Settings.Default.BackupOwnCode = chkBackupOwnCode.Checked; S.ettingBackupOwnCode = Properties.Settings.Default.BackupOwnCode = chkBackupOwnCode.Checked;
S.ettingLogVarName = Properties.Settings.Default.LogVarName = txtLogPost.Text; S.ettingLogVarName = Properties.Settings.Default.LogVarName = txtLogPost.Text;
S.ettingLogSectName = Properties.Settings.Default.LogSectName = txtLogSection.Text; S.ettingLogSectName = Properties.Settings.Default.LogSectName = txtLogSection.Text;
@ -334,7 +334,7 @@ namespace CobXmlSupport
tmpChkUniqueVars = chkUniqueVars.Checked = S.ettingUniqueVars; tmpChkUniqueVars = chkUniqueVars.Checked = S.ettingUniqueVars;
tmpChkValues = chkValues.Checked = S.ettingValues; tmpChkValues = chkValues.Checked = S.ettingValues;
tmpChkWrap = chkWrap.Checked = S.ettingWrap; tmpChkWrap = chkWrap.Checked = S.ettingWrap;
tmpShowTestBtns = chkShowTestbtns.Checked = S.ettingSpecials; tmpShowTestBtns = chkShowTestbtns.Checked = S.ettingShowTestbtns;
tmpBackupOwnCode = chkBackupOwnCode.Checked = S.ettingBackupOwnCode; tmpBackupOwnCode = chkBackupOwnCode.Checked = S.ettingBackupOwnCode;
txtLogVarNameTmp = txtLogPost.Text = S.ettingLogVarName; txtLogVarNameTmp = txtLogPost.Text = S.ettingLogVarName;
txtLogVarSectTmp = txtLogSection.Text = S.ettingLogSectName; txtLogVarSectTmp = txtLogSection.Text = S.ettingLogSectName;