Straßenliste code cleanup

radiobuttons hinzugefügt, noch kein Funktion
This commit is contained in:
HuskyTeufel
2021-04-09 11:58:05 +02:00
parent 3fb135459a
commit 88323fcd29
4 changed files with 64 additions and 22 deletions

View File

@@ -218,7 +218,9 @@
<Compile Include="frmSelectNewSan.Designer.cs">
<DependentUpon>frmSelectNewSan.cs</DependentUpon>
</Compile>
<Compile Include="frmStrassenList.cs" />
<Compile Include="frmStrassenList.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="frmStrassenList.Designer.cs">
<DependentUpon>frmStrassenList.cs</DependentUpon>
</Compile>
@@ -233,6 +235,7 @@
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Sanierungsarten.cs" />
<Compile Include="StrassenContent.cs" />
<Compile Include="UCInliner.cs">
<SubType>UserControl</SubType>
</Compile>

View File

@@ -0,0 +1,15 @@
namespace SanSystem
{
class StrassenContent
{
public string Strassename;
public int AnzahlObjekte;
public int AnzahlFertig;
public override string ToString()
{
return string.Format("{0} ({1} / {2})", Strassename, AnzahlFertig, AnzahlObjekte);
}
}
}

View File

@@ -30,6 +30,8 @@
{
this.lst_strassen = new System.Windows.Forms.ListBox();
this.btn_add = new System.Windows.Forms.Button();
this.rdbtn_street = new System.Windows.Forms.RadioButton();
this.rdbtn_ort = new System.Windows.Forms.RadioButton();
this.SuspendLayout();
//
// lst_strassen
@@ -39,11 +41,11 @@
| System.Windows.Forms.AnchorStyles.Right)));
this.lst_strassen.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lst_strassen.FormattingEnabled = true;
this.lst_strassen.ItemHeight = 25;
this.lst_strassen.Location = new System.Drawing.Point(16, 122);
this.lst_strassen.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.lst_strassen.ItemHeight = 20;
this.lst_strassen.Location = new System.Drawing.Point(12, 130);
this.lst_strassen.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.lst_strassen.Name = "lst_strassen";
this.lst_strassen.Size = new System.Drawing.Size(252, 529);
this.lst_strassen.Size = new System.Drawing.Size(190, 424);
this.lst_strassen.TabIndex = 0;
this.lst_strassen.DoubleClick += new System.EventHandler(this.lst_strassen_DoubleClick);
//
@@ -52,28 +54,52 @@
this.btn_add.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.btn_add.Image = global::SanSystem.Properties.Resources.Add1;
this.btn_add.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.btn_add.Location = new System.Drawing.Point(16, 15);
this.btn_add.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.btn_add.Location = new System.Drawing.Point(12, 12);
this.btn_add.Name = "btn_add";
this.btn_add.Size = new System.Drawing.Size(251, 101);
this.btn_add.Size = new System.Drawing.Size(188, 82);
this.btn_add.TabIndex = 1;
this.btn_add.Text = "Neues \r\nObjekt hinzufügen";
this.btn_add.UseVisualStyleBackColor = true;
this.btn_add.Click += new System.EventHandler(this.btn_add_Click);
//
// rdbtn_street
//
this.rdbtn_street.AutoSize = true;
this.rdbtn_street.Location = new System.Drawing.Point(19, 107);
this.rdbtn_street.Name = "rdbtn_street";
this.rdbtn_street.Size = new System.Drawing.Size(80, 17);
this.rdbtn_street.TabIndex = 2;
this.rdbtn_street.TabStop = true;
this.rdbtn_street.Text = "Straßenliste";
this.rdbtn_street.UseVisualStyleBackColor = true;
//
// rdbtn_ort
//
this.rdbtn_ort.AutoSize = true;
this.rdbtn_ort.Location = new System.Drawing.Point(110, 107);
this.rdbtn_ort.Name = "rdbtn_ort";
this.rdbtn_ort.Size = new System.Drawing.Size(63, 17);
this.rdbtn_ort.TabIndex = 3;
this.rdbtn_ort.TabStop = true;
this.rdbtn_ort.Text = "Ortsteile";
this.rdbtn_ort.UseVisualStyleBackColor = true;
//
// frmStrassenList
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(283, 672);
this.ClientSize = new System.Drawing.Size(212, 565);
this.ControlBox = false;
this.Controls.Add(this.rdbtn_ort);
this.Controls.Add(this.rdbtn_street);
this.Controls.Add(this.btn_add);
this.Controls.Add(this.lst_strassen);
this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.Name = "frmStrassenList";
this.Text = "Strassen";
this.Load += new System.EventHandler(this.frmStrassenList_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
@@ -81,5 +107,7 @@
private System.Windows.Forms.ListBox lst_strassen;
private System.Windows.Forms.Button btn_add;
private System.Windows.Forms.RadioButton rdbtn_street;
private System.Windows.Forms.RadioButton rdbtn_ort;
}
}

View File

@@ -13,17 +13,6 @@ using System.Windows.Forms;
namespace SanSystem
{
class StrassenContent
{
public string Strassename;
public int AnzahlObjekte;
public int AnzahlFertig;
public override string ToString()
{
return string.Format("{0} ({1} / {2})", Strassename, AnzahlFertig, AnzahlObjekte);
}
}
/// <summary>
///
/// </summary>
@@ -38,10 +27,17 @@ namespace SanSystem
InitializeComponent();
}
bool mehrereOrteAktiv()
{
return Datenbank.Instance.loadedProjekt.Objekte.Select(x => x.OrtName).Distinct().Count() > 1;
}
private void buildStreetList()
{
lst_strassen.DataSource = null;
if (Datenbank.Instance.loadedProjekt == null) return;
rdbtn_ort.Enabled = mehrereOrteAktiv();
if (!mehrereOrteAktiv()) rdbtn_street.Checked = true;
List<string> strassen = Datenbank.Instance.loadedProjekt.Objekte.Select(x => x.StrasseName).Distinct().ToList();
List<string> streets = new List<string>();
List<StrassenContent> strassenContents = new List<StrassenContent>();