From 009faaccde5583693a9a2026e27d15fdd8fc624a Mon Sep 17 00:00:00 2001 From: Husky Date: Tue, 13 Aug 2019 21:32:18 +0200 Subject: [PATCH] ExceptionWindow erzeugt --- SanSystem/frmExceptionWindow.Designer.cs | 34 +++++++++++++++++++++++- SanSystem/frmExceptionWindow.cs | 16 ++++++++++- SanSystem/frmMain.cs | 11 +++++--- 3 files changed, 55 insertions(+), 6 deletions(-) diff --git a/SanSystem/frmExceptionWindow.Designer.cs b/SanSystem/frmExceptionWindow.Designer.cs index e3a0522..f5b15a4 100644 --- a/SanSystem/frmExceptionWindow.Designer.cs +++ b/SanSystem/frmExceptionWindow.Designer.cs @@ -28,19 +28,51 @@ /// private void InitializeComponent() { + this.button1 = new System.Windows.Forms.Button(); + this.txt_error = new System.Windows.Forms.TextBox(); this.SuspendLayout(); // + // button1 + // + this.button1.Font = new System.Drawing.Font("Microsoft Sans Serif", 16.2F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.button1.Location = new System.Drawing.Point(12, 389); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(911, 75); + this.button1.TabIndex = 0; + this.button1.Text = "OK"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.Button1_Click); + // + // txt_error + // + this.txt_error.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.txt_error.Font = new System.Drawing.Font("Microsoft Sans Serif", 13.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.txt_error.Location = new System.Drawing.Point(12, 12); + this.txt_error.Multiline = true; + this.txt_error.Name = "txt_error"; + this.txt_error.Size = new System.Drawing.Size(911, 371); + this.txt_error.TabIndex = 1; + // // frmExceptionWindow // this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(800, 450); + this.ClientSize = new System.Drawing.Size(935, 476); + this.ControlBox = false; + this.Controls.Add(this.txt_error); + this.Controls.Add(this.button1); this.Name = "frmExceptionWindow"; this.Text = "ExceptionWindow"; this.ResumeLayout(false); + this.PerformLayout(); } #endregion + + private System.Windows.Forms.Button button1; + private System.Windows.Forms.TextBox txt_error; } } \ No newline at end of file diff --git a/SanSystem/frmExceptionWindow.cs b/SanSystem/frmExceptionWindow.cs index 1a622f1..4d29382 100644 --- a/SanSystem/frmExceptionWindow.cs +++ b/SanSystem/frmExceptionWindow.cs @@ -10,11 +10,25 @@ using System.Windows.Forms; namespace SanSystem { + /// + /// + /// public partial class frmExceptionWindow : Form { - public frmExceptionWindow() + /// + /// + /// + /// + public frmExceptionWindow(string message) { InitializeComponent(); + txt_error.Text = message; + txt_error.ReadOnly = true; + } + + private void Button1_Click(object sender, EventArgs e) + { + Environment.Exit(0); } } } diff --git a/SanSystem/frmMain.cs b/SanSystem/frmMain.cs index 94f0c5b..770d4f9 100644 --- a/SanSystem/frmMain.cs +++ b/SanSystem/frmMain.cs @@ -39,8 +39,9 @@ namespace SanSystem } catch(DataBaseVersionMismatchException ex) { - MessageBox.Show("Software und Datenbank passen nicht zusammen\nProgramm wird beendet\n"+ex.Message); - Environment.Exit(0); + frmExceptionWindow frmException = new frmExceptionWindow(ex.Message); + frmException.FormClosed += FrmException_FormClosed; + frmException.ShowDialog(); } //Datenbank.Instance.CreateProjekt(""); @@ -68,8 +69,10 @@ namespace SanSystem } - - + private void FrmException_FormClosed(object sender, FormClosedEventArgs e) + { + Environment.Exit(0); + } private void frm_main_Load(object sender, EventArgs e) {