Statusnachrichten werden im Mainform dargestellt

This commit is contained in:
HuskyTeufel
2021-04-16 11:43:16 +02:00
parent 23e19900bb
commit 39a0a503b7
4 changed files with 45 additions and 2 deletions

View File

@@ -14,6 +14,7 @@ namespace SanSystem
class Global
{
public event EventHandler RequestBuildNewLinerReste;
public event EventHandler OnStatusMessageChanged;
public static readonly Global instance = new Global();
const string userroot = "HKEY_CURRENT_USER\\Software";
@@ -24,8 +25,31 @@ namespace SanSystem
string projektpfad = "18-850";
string statusMessage = "";
public string StatusMessage
{
get
{
return statusMessage;
}
set
{
if (statusMessage == value) return;
statusMessage = value;
StatusMessageChanged(EventArgs.Empty);
}
}
public CSVParser.AcceptedCSVFormats AnlageType = CSVParser.AcceptedCSVFormats.BLUELIGHT;
public void StatusMessageChanged(EventArgs args)
{
EventHandler handler = OnStatusMessageChanged;
if (handler != null)
handler(this, args);
}
public void BuildNewLinerReste(EventArgs args)
{
EventHandler handler = RequestBuildNewLinerReste;

View File

@@ -346,6 +346,7 @@ namespace SanSystem
private void GeneriereDP()
{
Global.Instance.StatusMessage = "Generiere Daten";
string dichtheitsprüfungsPfad = Path.Combine(Global.Instance.Projektpfad, "Dichtheitsprüfung");
if (!Directory.Exists(dichtheitsprüfungsPfad))
Directory.CreateDirectory(dichtheitsprüfungsPfad);
@@ -367,6 +368,7 @@ namespace SanSystem
protokollWriter.GenerateMessreiheÜberdruck(startprüfung, 100);
protokollWriter.Ersetzen();
protokollWriter.WriteFile();
Global.Instance.StatusMessage = "Datengenerierung abgeschlossen";
MessageBox.Show("Fertig");
}

View File

@@ -50,6 +50,7 @@
this.toolStripStatus_projekt_Label = new System.Windows.Forms.ToolStripStatusLabel();
this.toolstrip_gesamtLiner = new System.Windows.Forms.ToolStripStatusLabel();
this.update = new UpdateLib.Updater();
this.toolstrip_messages = new System.Windows.Forms.ToolStripStatusLabel();
this.mainmenu.SuspendLayout();
this.statusStrip1.SuspendLayout();
this.SuspendLayout();
@@ -180,7 +181,8 @@
this.statusStrip1.ImageScalingSize = new System.Drawing.Size(20, 20);
this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.toolStripStatus_projekt_Label,
this.toolstrip_gesamtLiner});
this.toolstrip_gesamtLiner,
this.toolstrip_messages});
this.statusStrip1.Location = new System.Drawing.Point(0, 431);
this.statusStrip1.Name = "statusStrip1";
this.statusStrip1.Size = new System.Drawing.Size(813, 22);
@@ -203,6 +205,13 @@
//
this.update.UpdateUrl = "http://home.cosysda.de/sanverwaltung/UpdateInfo.dat";
//
// toolstrip_messages
//
this.toolstrip_messages.Name = "toolstrip_messages";
this.toolstrip_messages.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
this.toolstrip_messages.Size = new System.Drawing.Size(16, 17);
this.toolstrip_messages.Text = "...";
//
// frmMain
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@@ -212,7 +221,7 @@
this.Controls.Add(this.mainmenu);
this.IsMdiContainer = true;
this.MainMenuStrip = this.mainmenu;
this.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.Margin = new System.Windows.Forms.Padding(2);
this.Name = "frmMain";
this.Text = "Kanalsanierungsverwaltung";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.frm_main_FormClosing);
@@ -247,6 +256,7 @@
private System.Windows.Forms.ToolStripStatusLabel toolstrip_gesamtLiner;
private System.Windows.Forms.ToolStripMenuItem prefixSuffixToolStripMenuItem;
private UpdateLib.Updater update;
private System.Windows.Forms.ToolStripStatusLabel toolstrip_messages;
}
}

View File

@@ -99,7 +99,14 @@ namespace SanSystem
toolstrip_gesamtLiner.Text = "Insgesamt wurde laut Erfassung " + gesamt.ToString() + "m an Liner eingebaut ("+anzahl.ToString()+")";
Global.Instance.OnStatusMessageChanged += Instance_OnStatusMessageChanged;
}
private void Instance_OnStatusMessageChanged(object sender, EventArgs e)
{
toolstrip_messages.Text = Global.Instance.StatusMessage;
}
private void FrmException_FormClosed(object sender, FormClosedEventArgs e)