Implementation of saver started

This commit is contained in:
2015-07-14 23:40:33 +02:00
parent 79d4c1cb27
commit a06104a7cc
7 changed files with 286 additions and 37 deletions

View File

@ -62,6 +62,7 @@
<Compile Include="GenCobCode.designer.cs"> <Compile Include="GenCobCode.designer.cs">
<DependentUpon>GenCobCode.cs</DependentUpon> <DependentUpon>GenCobCode.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="GenSetting.cs" />
<Compile Include="IndexState.cs" /> <Compile Include="IndexState.cs" />
<Compile Include="IndStatus.cs" /> <Compile Include="IndStatus.cs" />
<Compile Include="Program.cs" /> <Compile Include="Program.cs" />
@ -69,6 +70,7 @@
<Compile Include="qualifieldhlp.cs" /> <Compile Include="qualifieldhlp.cs" />
<Compile Include="RowWord.cs" /> <Compile Include="RowWord.cs" />
<Compile Include="S.cs" /> <Compile Include="S.cs" />
<Compile Include="SaverListener.cs" />
<Compile Include="ShowCode.cs"> <Compile Include="ShowCode.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>

View File

@ -20,6 +20,7 @@ using System.Resources;
// //
// //
// ====== BEFORE IMPLEMENTATION OF SAVER ============== // ====== BEFORE IMPLEMENTATION OF SAVER ==============
// ====== IMPLEMENTATION OF SAVER STARTED =============
//---------------------------------------------------------------------- //----------------------------------------------------------------------
namespace CobXmlSupport namespace CobXmlSupport
{ {
@ -1197,6 +1198,9 @@ namespace CobXmlSupport
setWindow.UserName = S.ettingUserName; setWindow.UserName = S.ettingUserName;
setWindow.CompanyName = S.ettingCompany; setWindow.CompanyName = S.ettingCompany;
setWindow.AktualFile = S.ettingActualFile;
setWindow.FilePath = S.ettingFilePath;
setWindow.ChkNoNsRef = S.ettingNoNsRef; setWindow.ChkNoNsRef = S.ettingNoNsRef;
setWindow.ChkUniqueVars = S.ettingUniqueVars; setWindow.ChkUniqueVars = S.ettingUniqueVars;
setWindow.ChkUniqueAttrVars = S.ettingUniqueAttrVars; setWindow.ChkUniqueAttrVars = S.ettingUniqueAttrVars;
@ -1214,6 +1218,7 @@ namespace CobXmlSupport
setWindow.ChkBackupOwnCode = S.ettingUserCodeBcup; setWindow.ChkBackupOwnCode = S.ettingUserCodeBcup;
setWindow.ShowDialog(); setWindow.ShowDialog();
S.ettingUserName = setWindow.UserName; S.ettingUserName = setWindow.UserName;
S.ettingCompany = setWindow.CompanyName; S.ettingCompany = setWindow.CompanyName;
S.ettingNoNsRef = setWindow.ChkNoNsRef; S.ettingNoNsRef = setWindow.ChkNoNsRef;

View File

@ -0,0 +1,92 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CobXmlSupport
{
public class GenSetting
{
public event SaveHandler evSave;
public EventArgs e = null;
public delegate void SaveHandler(GenSetting G, EventArgs e);
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 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 void GetSettings()
{
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.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;
if (evSave != null)
{
evSave(this, e);
}
}
public void SetSettings()
{
S.ettingActualFile =this.ActualFile ;
S.ettingFilePath = this.FilePath;
S.ettingUserName = this.UserName;
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.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;
}
}
}

View File

@ -27,5 +27,11 @@ namespace CobXmlSupport
public static bool ettingSpecials; public static bool ettingSpecials;
public static bool ettingUserCodeBcup; public static bool ettingUserCodeBcup;
//------------------------- //-------------------------
// public static bool ettingShowTestbtns;
public static bool ettingBackupOwnCode;
public static string ettingActualFile;
public static string ettingFilePath;
//-------------------------
} }
} }

View File

@ -0,0 +1,29 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CobXmlSupport
{
public class SaverListener
{
public Dictionary<string, GenSetting> dict { get; set; }
public void Subscribe(GenSetting G)
{
G.evSave += new GenSetting.SaveHandler(SaveMethod);
}
public void UnSubscribe(GenSetting G)
{
G.evSave -= new GenSetting.SaveHandler(SaveMethod);
}
private void SaveMethod(GenSetting G, EventArgs e)
{
dict.Add(G.ActualFile, G);
}
}
}

View File

@ -57,8 +57,12 @@
this.txtLogSection = new System.Windows.Forms.TextBox(); this.txtLogSection = new System.Windows.Forms.TextBox();
this.label7 = new System.Windows.Forms.Label(); this.label7 = new System.Windows.Forms.Label();
this.specials = new System.Windows.Forms.GroupBox(); this.specials = new System.Windows.Forms.GroupBox();
this.chkShowTestbtns = new System.Windows.Forms.CheckBox();
this.chkBackupOwnCode = new System.Windows.Forms.CheckBox(); this.chkBackupOwnCode = new System.Windows.Forms.CheckBox();
this.chkShowTestbtns = new System.Windows.Forms.CheckBox();
this.txtActualFile = new System.Windows.Forms.TextBox();
this.txtFilePath = new System.Windows.Forms.TextBox();
this.label9 = new System.Windows.Forms.Label();
this.label10 = new System.Windows.Forms.Label();
this.groupBox1.SuspendLayout(); this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout(); this.groupBox2.SuspendLayout();
this.specials.SuspendLayout(); this.specials.SuspendLayout();
@ -67,7 +71,7 @@
// btnCancel // btnCancel
// //
this.btnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.btnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnCancel.Location = new System.Drawing.Point(487, 370); this.btnCancel.Location = new System.Drawing.Point(467, 416);
this.btnCancel.Margin = new System.Windows.Forms.Padding(2); this.btnCancel.Margin = new System.Windows.Forms.Padding(2);
this.btnCancel.Name = "btnCancel"; this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(79, 24); this.btnCancel.Size = new System.Drawing.Size(79, 24);
@ -79,7 +83,7 @@
// btnSave // btnSave
// //
this.btnSave.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.btnSave.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnSave.Location = new System.Drawing.Point(403, 370); this.btnSave.Location = new System.Drawing.Point(383, 416);
this.btnSave.Margin = new System.Windows.Forms.Padding(2); this.btnSave.Margin = new System.Windows.Forms.Padding(2);
this.btnSave.Name = "btnSave"; this.btnSave.Name = "btnSave";
this.btnSave.Size = new System.Drawing.Size(79, 24); this.btnSave.Size = new System.Drawing.Size(79, 24);
@ -110,7 +114,7 @@
// //
// txtUserName // txtUserName
// //
this.txtUserName.Location = new System.Drawing.Point(101, 42); this.txtUserName.Location = new System.Drawing.Point(108, 41);
this.txtUserName.Margin = new System.Windows.Forms.Padding(2); this.txtUserName.Margin = new System.Windows.Forms.Padding(2);
this.txtUserName.Name = "txtUserName"; this.txtUserName.Name = "txtUserName";
this.txtUserName.Size = new System.Drawing.Size(195, 20); this.txtUserName.Size = new System.Drawing.Size(195, 20);
@ -118,7 +122,7 @@
// //
// txtCompanyName // txtCompanyName
// //
this.txtCompanyName.Location = new System.Drawing.Point(101, 62); this.txtCompanyName.Location = new System.Drawing.Point(108, 61);
this.txtCompanyName.Margin = new System.Windows.Forms.Padding(2); this.txtCompanyName.Margin = new System.Windows.Forms.Padding(2);
this.txtCompanyName.Name = "txtCompanyName"; this.txtCompanyName.Name = "txtCompanyName";
this.txtCompanyName.Size = new System.Drawing.Size(195, 20); this.txtCompanyName.Size = new System.Drawing.Size(195, 20);
@ -254,6 +258,8 @@
// //
// groupBox1 // groupBox1
// //
this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBox1.Controls.Add(this.txtExpPrefix); this.groupBox1.Controls.Add(this.txtExpPrefix);
this.groupBox1.Controls.Add(this.label8); this.groupBox1.Controls.Add(this.label8);
this.groupBox1.Controls.Add(this.label5); this.groupBox1.Controls.Add(this.label5);
@ -268,9 +274,9 @@
this.groupBox1.Controls.Add(this.chkWrap); this.groupBox1.Controls.Add(this.chkWrap);
this.groupBox1.Controls.Add(this.label4); this.groupBox1.Controls.Add(this.label4);
this.groupBox1.Controls.Add(this.chkUnique); this.groupBox1.Controls.Add(this.chkUnique);
this.groupBox1.Location = new System.Drawing.Point(15, 110); this.groupBox1.Location = new System.Drawing.Point(15, 157);
this.groupBox1.Name = "groupBox1"; this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(304, 255); this.groupBox1.Size = new System.Drawing.Size(287, 260);
this.groupBox1.TabIndex = 39; this.groupBox1.TabIndex = 39;
this.groupBox1.TabStop = false; this.groupBox1.TabStop = false;
this.groupBox1.Text = "Utgångs inställningar"; this.groupBox1.Text = "Utgångs inställningar";
@ -294,13 +300,14 @@
// //
// groupBox2 // groupBox2
// //
this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.groupBox2.Controls.Add(this.label6); this.groupBox2.Controls.Add(this.label6);
this.groupBox2.Controls.Add(this.txtLogPost); this.groupBox2.Controls.Add(this.txtLogPost);
this.groupBox2.Controls.Add(this.txtLogSection); this.groupBox2.Controls.Add(this.txtLogSection);
this.groupBox2.Controls.Add(this.label7); this.groupBox2.Controls.Add(this.label7);
this.groupBox2.Location = new System.Drawing.Point(325, 110); this.groupBox2.Location = new System.Drawing.Point(306, 157);
this.groupBox2.Name = "groupBox2"; this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(240, 99); this.groupBox2.Size = new System.Drawing.Size(240, 104);
this.groupBox2.TabIndex = 40; this.groupBox2.TabIndex = 40;
this.groupBox2.TabStop = false; this.groupBox2.TabStop = false;
this.groupBox2.Text = "Namn på generella variabler och procedurer"; this.groupBox2.Text = "Namn på generella variabler och procedurer";
@ -340,25 +347,16 @@
// //
// specials // specials
// //
this.specials.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.specials.Controls.Add(this.chkBackupOwnCode); this.specials.Controls.Add(this.chkBackupOwnCode);
this.specials.Controls.Add(this.chkShowTestbtns); this.specials.Controls.Add(this.chkShowTestbtns);
this.specials.Location = new System.Drawing.Point(325, 216); this.specials.Location = new System.Drawing.Point(305, 263);
this.specials.Name = "specials"; this.specials.Name = "specials";
this.specials.Size = new System.Drawing.Size(240, 149); this.specials.Size = new System.Drawing.Size(240, 149);
this.specials.TabIndex = 41; this.specials.TabIndex = 41;
this.specials.TabStop = false; this.specials.TabStop = false;
this.specials.Text = "specialla inställningar"; this.specials.Text = "specialla inställningar";
// //
// chkShowTestbtns
//
this.chkShowTestbtns.AutoSize = true;
this.chkShowTestbtns.Location = new System.Drawing.Point(7, 20);
this.chkShowTestbtns.Name = "chkShowTestbtns";
this.chkShowTestbtns.Size = new System.Drawing.Size(95, 17);
this.chkShowTestbtns.TabIndex = 0;
this.chkShowTestbtns.Text = "visa testknapp";
this.chkShowTestbtns.UseVisualStyleBackColor = true;
//
// chkBackupOwnCode // chkBackupOwnCode
// //
this.chkBackupOwnCode.AutoSize = true; this.chkBackupOwnCode.AutoSize = true;
@ -369,11 +367,63 @@
this.chkBackupOwnCode.Text = "Backup av Egna vars"; this.chkBackupOwnCode.Text = "Backup av Egna vars";
this.chkBackupOwnCode.UseVisualStyleBackColor = true; this.chkBackupOwnCode.UseVisualStyleBackColor = true;
// //
// chkShowTestbtns
//
this.chkShowTestbtns.AutoSize = true;
this.chkShowTestbtns.Location = new System.Drawing.Point(7, 20);
this.chkShowTestbtns.Name = "chkShowTestbtns";
this.chkShowTestbtns.Size = new System.Drawing.Size(95, 17);
this.chkShowTestbtns.TabIndex = 0;
this.chkShowTestbtns.Text = "visa testknapp";
this.chkShowTestbtns.UseVisualStyleBackColor = true;
//
// txtActualFile
//
this.txtActualFile.ForeColor = System.Drawing.SystemColors.WindowFrame;
this.txtActualFile.Location = new System.Drawing.Point(108, 82);
this.txtActualFile.Name = "txtActualFile";
this.txtActualFile.ReadOnly = true;
this.txtActualFile.Size = new System.Drawing.Size(425, 20);
this.txtActualFile.TabIndex = 42;
//
// txtFilePath
//
this.txtFilePath.ForeColor = System.Drawing.SystemColors.WindowFrame;
this.txtFilePath.Location = new System.Drawing.Point(108, 103);
this.txtFilePath.Name = "txtFilePath";
this.txtFilePath.ReadOnly = true;
this.txtFilePath.Size = new System.Drawing.Size(425, 20);
this.txtFilePath.TabIndex = 43;
//
// label9
//
this.label9.AutoSize = true;
this.label9.Location = new System.Drawing.Point(14, 107);
this.label9.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(93, 13);
this.label9.TabIndex = 45;
this.label9.Text = "Urspr Filens Path :";
//
// label10
//
this.label10.AutoSize = true;
this.label10.Location = new System.Drawing.Point(12, 86);
this.label10.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label10.Name = "label10";
this.label10.Size = new System.Drawing.Size(83, 13);
this.label10.TabIndex = 44;
this.label10.Text = "Aktuell Urspr Fil:";
//
// frmSettings // frmSettings
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(577, 399); this.ClientSize = new System.Drawing.Size(557, 445);
this.Controls.Add(this.label9);
this.Controls.Add(this.label10);
this.Controls.Add(this.txtFilePath);
this.Controls.Add(this.txtActualFile);
this.Controls.Add(this.specials); this.Controls.Add(this.specials);
this.Controls.Add(this.groupBox2); this.Controls.Add(this.groupBox2);
this.Controls.Add(this.groupBox1); this.Controls.Add(this.groupBox1);
@ -432,5 +482,9 @@
private System.Windows.Forms.GroupBox specials; private System.Windows.Forms.GroupBox specials;
private System.Windows.Forms.CheckBox chkShowTestbtns; private System.Windows.Forms.CheckBox chkShowTestbtns;
private System.Windows.Forms.CheckBox chkBackupOwnCode; private System.Windows.Forms.CheckBox chkBackupOwnCode;
private System.Windows.Forms.TextBox txtActualFile;
private System.Windows.Forms.TextBox txtFilePath;
private System.Windows.Forms.Label label9;
private System.Windows.Forms.Label label10;
} }
} }

View File

@ -29,7 +29,61 @@ namespace CobXmlSupport
private string txtLogVarNameTmp; private string txtLogVarNameTmp;
private string txtLogVarSectTmp; 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() public frmSettings()
{ {
InitializeComponent(); InitializeComponent();
@ -235,23 +289,30 @@ namespace CobXmlSupport
private void btnSave_Click(object sender, EventArgs e) private void btnSave_Click(object sender, EventArgs e)
{ {
Properties.Settings.Default.AnaTag = chkAnaTag.Checked; sl.Subscribe(this.genSet);
Properties.Settings.Default.CountVars = chkCountVars.Checked;
Properties.Settings.Default.MaxOcc = txtMaxOcc.Text; S.ettingActualFile = this.AktualFile;
Properties.Settings.Default.NoNsRef = chkNoNsRef.Checked; S.ettingFilePath = this.FilePath;
Properties.Settings.Default.Prefix = txtPrefix.Text; S.ettingAnaTag = Properties.Settings.Default.AnaTag = chkAnaTag.Checked;
Properties.Settings.Default.ExpPrefix = txtExpPrefix.Text; S.ettingCountVars = Properties.Settings.Default.CountVars = chkCountVars.Checked;
Properties.Settings.Default.Unique = chkUnique.Checked; S.ettingMaxOcc = Properties.Settings.Default.MaxOcc = txtMaxOcc.Text;
Properties.Settings.Default.UniqueAttrVars = chkUniqueAttrVars.Checked; S.ettingNoNsRef = Properties.Settings.Default.NoNsRef = chkNoNsRef.Checked;
Properties.Settings.Default.UniqueVars = chkUniqueVars.Checked; S.ettingPrefix = Properties.Settings.Default.Prefix = txtPrefix.Text;
Properties.Settings.Default.Values = chkValues.Checked; S.ettingExpPrefix = Properties.Settings.Default.ExpPrefix = txtExpPrefix.Text;
Properties.Settings.Default.Wrap = chkWrap.Checked; S.ettingUnique = Properties.Settings.Default.Unique = chkUnique.Checked;
Properties.Settings.Default.ShowTestbtns= chkShowTestbtns.Checked; S.ettingUniqueAttrVars = Properties.Settings.Default.UniqueAttrVars = chkUniqueAttrVars.Checked;
Properties.Settings.Default.BackupOwnCode = chkBackupOwnCode.Checked; S.ettingUniqueVars = Properties.Settings.Default.UniqueVars = chkUniqueVars.Checked;
Properties.Settings.Default.LogVarName = txtLogPost.Text; S.ettingValues = Properties.Settings.Default.Values = chkValues.Checked;
Properties.Settings.Default.LogSectName = txtLogSection.Text; 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(); Properties.Settings.Default.Save();
this.genSet.GetSettings();
this.sl.UnSubscribe(this.genSet);
this.Close(); this.Close();
} }