diff --git a/SanSystem/FrmSelectNewSan.Designer.cs b/SanSystem/FrmSelectNewSan.Designer.cs index e750eb7..59261b6 100644 --- a/SanSystem/FrmSelectNewSan.Designer.cs +++ b/SanSystem/FrmSelectNewSan.Designer.cs @@ -62,6 +62,7 @@ this.btn_kurzliner.TabIndex = 2; this.btn_kurzliner.Text = "button3"; this.btn_kurzliner.UseVisualStyleBackColor = true; + this.btn_kurzliner.Click += new System.EventHandler(this.btn_kurzliner_Click); // // btn_hut // @@ -71,6 +72,7 @@ this.btn_hut.TabIndex = 3; this.btn_hut.Text = "button4"; this.btn_hut.UseVisualStyleBackColor = true; + this.btn_hut.Click += new System.EventHandler(this.btn_hut_Click); // // FrmSelectNewSan // diff --git a/SanSystem/FrmSelectNewSan.cs b/SanSystem/FrmSelectNewSan.cs index 88d76c7..77618fb 100644 --- a/SanSystem/FrmSelectNewSan.cs +++ b/SanSystem/FrmSelectNewSan.cs @@ -23,6 +23,14 @@ namespace SanSystem /// /// public event EventHandler AddSchachtAnbindungClicked; + /// + /// + /// + public event EventHandler AddKurzlinerClicked; + /// + /// + /// + public event EventHandler AddHutprofilClicked; /// /// @@ -40,19 +48,36 @@ namespace SanSystem EventHandler handler = AddInlinerClicked; if (handler != null) handler(this, e); } + protected virtual void OnAddKurzlinerClicked(EventArgs e) + { + EventHandler handler = AddKurzlinerClicked; + if (handler != null) handler(this, e); + } + protected virtual void OnAddHutClicked(EventArgs e) + { + EventHandler handler = AddHutprofilClicked; + if (handler != null) handler(this, e); + } /// /// /// - public FrmSelectNewSan() + /// + public FrmSelectNewSan(int mod) { InitializeComponent(); + SanArt sanArt = new SanArt(mod); + btn_inliner.Text = Global.Instance.language.Labels["inliner"]; btn_hut.Text = Global.Instance.language.Labels["hut"]; btn_kurzliner.Text = Global.Instance.language.Labels["kurzliner"]; btn_schacht_anb.Text = Global.Instance.language.Labels["schacht_an"]; - btn_hut.Enabled = btn_kurzliner.Enabled = false; + btn_inliner.Enabled = sanArt.SanierungActivated(Sanierungsarten.INLINER); + btn_kurzliner.Enabled = sanArt.SanierungActivated(Sanierungsarten.KURZLINER); + btn_hut.Enabled = sanArt.SanierungActivated(Sanierungsarten.HUTPROFIL); + btn_schacht_anb.Enabled = sanArt.SanierungActivated(Sanierungsarten.SCHACHTANBINDUNG); + //btn_hut.Enabled = btn_kurzliner.Enabled = false; } private void btn_inliner_Click(object sender, EventArgs e) @@ -66,5 +91,17 @@ namespace SanSystem OnAddSchachtAnbindungClicked(EventArgs.Empty); this.Close(); } + + private void btn_kurzliner_Click(object sender, EventArgs e) + { + OnAddKurzlinerClicked(EventArgs.Empty); + this.Close(); + } + + private void btn_hut_Click(object sender, EventArgs e) + { + OnAddHutClicked(EventArgs.Empty); + this.Close(); + } } } diff --git a/SanSystem/SanSystem.csproj b/SanSystem/SanSystem.csproj index 28c9ee9..487a265 100644 --- a/SanSystem/SanSystem.csproj +++ b/SanSystem/SanSystem.csproj @@ -153,6 +153,7 @@ + UserControl diff --git a/SanSystem/Sanierungsarten.cs b/SanSystem/Sanierungsarten.cs new file mode 100644 index 0000000..c5b1141 --- /dev/null +++ b/SanSystem/Sanierungsarten.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SanSystem +{ + enum Sanierungsarten + { + INLINER = 1, + SCHACHTANBINDUNG = 2, + KURZLINER = 4, + HUTPROFIL = 8, + QUICKLOCK = 16 + } + + class SanArt + { + private int mod; + + public SanArt(int mod) + { + this.mod = mod; + } + public bool SanierungActivated(Sanierungsarten pm) + { + return (mod & (int)pm) == (int)pm; + } + } +} diff --git a/SanSystem/frmObjektEdit.cs b/SanSystem/frmObjektEdit.cs index 4c88191..9300b44 100644 --- a/SanSystem/frmObjektEdit.cs +++ b/SanSystem/frmObjektEdit.cs @@ -117,7 +117,8 @@ namespace SanSystem private void btn_add_san_Click(object sender, EventArgs e) { - FrmSelectNewSan frmSelectNewSan = new FrmSelectNewSan(); + int mod = (int)Sanierungsarten.INLINER ^ (int)Sanierungsarten.SCHACHTANBINDUNG; + FrmSelectNewSan frmSelectNewSan = new FrmSelectNewSan(mod); frmSelectNewSan.AddInlinerClicked += FrmSelectNewSan_AddInlinerClicked; frmSelectNewSan.AddSchachtAnbindungClicked += FrmSelectNewSan_AddSchachtAnbindungClicked;