Sanierungsarten nun steuerbar von ausßenhalb

This commit is contained in:
Husky
2018-07-21 15:55:04 +02:00
parent ea3b8c564a
commit 81b58aa6d0
5 changed files with 72 additions and 3 deletions

View File

@@ -62,6 +62,7 @@
this.btn_kurzliner.TabIndex = 2; this.btn_kurzliner.TabIndex = 2;
this.btn_kurzliner.Text = "button3"; this.btn_kurzliner.Text = "button3";
this.btn_kurzliner.UseVisualStyleBackColor = true; this.btn_kurzliner.UseVisualStyleBackColor = true;
this.btn_kurzliner.Click += new System.EventHandler(this.btn_kurzliner_Click);
// //
// btn_hut // btn_hut
// //
@@ -71,6 +72,7 @@
this.btn_hut.TabIndex = 3; this.btn_hut.TabIndex = 3;
this.btn_hut.Text = "button4"; this.btn_hut.Text = "button4";
this.btn_hut.UseVisualStyleBackColor = true; this.btn_hut.UseVisualStyleBackColor = true;
this.btn_hut.Click += new System.EventHandler(this.btn_hut_Click);
// //
// FrmSelectNewSan // FrmSelectNewSan
// //

View File

@@ -14,6 +14,8 @@ namespace SanSystem
{ {
public event EventHandler AddInlinerClicked; public event EventHandler AddInlinerClicked;
public event EventHandler AddSchachtAnbindungClicked; public event EventHandler AddSchachtAnbindungClicked;
public event EventHandler AddKurzlinerClicked;
public event EventHandler AddHutprofilClicked;
protected virtual void OnAddSchachtAnbindungClicked(EventArgs e) protected virtual void OnAddSchachtAnbindungClicked(EventArgs e)
{ {
@@ -25,16 +27,36 @@ namespace SanSystem
EventHandler handler = AddInlinerClicked; EventHandler handler = AddInlinerClicked;
if (handler != null) handler(this, e); if (handler != null) handler(this, e);
} }
public FrmSelectNewSan() 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);
}
/// <summary>
///
/// </summary>
/// <param name="mod"></param>
public FrmSelectNewSan(int mod)
{ {
InitializeComponent(); InitializeComponent();
SanArt sanArt = new SanArt(mod);
btn_inliner.Text = Global.Instance.language.Labels["inliner"]; btn_inliner.Text = Global.Instance.language.Labels["inliner"];
btn_hut.Text = Global.Instance.language.Labels["hut"]; btn_hut.Text = Global.Instance.language.Labels["hut"];
btn_kurzliner.Text = Global.Instance.language.Labels["kurzliner"]; btn_kurzliner.Text = Global.Instance.language.Labels["kurzliner"];
btn_schacht_anb.Text = Global.Instance.language.Labels["schacht_an"]; 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) private void btn_inliner_Click(object sender, EventArgs e)
@@ -48,5 +70,17 @@ namespace SanSystem
OnAddSchachtAnbindungClicked(EventArgs.Empty); OnAddSchachtAnbindungClicked(EventArgs.Empty);
this.Close(); 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();
}
} }
} }

View File

@@ -141,6 +141,7 @@
<Compile Include="MassenStatistik.cs" /> <Compile Include="MassenStatistik.cs" />
<Compile Include="Program.cs" /> <Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Sanierungsarten.cs" />
<Compile Include="UCInliner.cs"> <Compile Include="UCInliner.cs">
<SubType>UserControl</SubType> <SubType>UserControl</SubType>
</Compile> </Compile>

View File

@@ -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;
}
}
}

View File

@@ -109,7 +109,8 @@ namespace SanSystem
private void btn_add_san_Click(object sender, EventArgs e) 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.AddInlinerClicked += FrmSelectNewSan_AddInlinerClicked;
frmSelectNewSan.AddSchachtAnbindungClicked += FrmSelectNewSan_AddSchachtAnbindungClicked; frmSelectNewSan.AddSchachtAnbindungClicked += FrmSelectNewSan_AddSchachtAnbindungClicked;