From dcc95477af0ea3b84dbd75a02dd9d09f22382c60 Mon Sep 17 00:00:00 2001 From: Husky Date: Tue, 13 Aug 2019 21:24:31 +0200 Subject: [PATCH 1/3] ExceptionWindow erstellt --- SanSystem/SanSystem.csproj | 9 ++ SanSystem/frmExceptionWindow.Designer.cs | 46 +++++++++ SanSystem/frmExceptionWindow.cs | 20 ++++ SanSystem/frmExceptionWindow.resx | 120 +++++++++++++++++++++++ SanSystem/frmMain.cs | 7 +- 5 files changed, 200 insertions(+), 2 deletions(-) create mode 100644 SanSystem/frmExceptionWindow.Designer.cs create mode 100644 SanSystem/frmExceptionWindow.cs create mode 100644 SanSystem/frmExceptionWindow.resx diff --git a/SanSystem/SanSystem.csproj b/SanSystem/SanSystem.csproj index 448121b..c1dec1e 100644 --- a/SanSystem/SanSystem.csproj +++ b/SanSystem/SanSystem.csproj @@ -82,6 +82,12 @@ frmAuftraggeberEdit.cs + + Form + + + frmExceptionWindow.cs + Form @@ -174,6 +180,9 @@ frmAuftraggeberEdit.cs + + frmExceptionWindow.cs + frmKalibrierungFestlegung.cs diff --git a/SanSystem/frmExceptionWindow.Designer.cs b/SanSystem/frmExceptionWindow.Designer.cs new file mode 100644 index 0000000..e3a0522 --- /dev/null +++ b/SanSystem/frmExceptionWindow.Designer.cs @@ -0,0 +1,46 @@ +namespace SanSystem +{ + partial class frmExceptionWindow + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.SuspendLayout(); + // + // 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.Name = "frmExceptionWindow"; + this.Text = "ExceptionWindow"; + this.ResumeLayout(false); + + } + + #endregion + } +} \ No newline at end of file diff --git a/SanSystem/frmExceptionWindow.cs b/SanSystem/frmExceptionWindow.cs new file mode 100644 index 0000000..1a622f1 --- /dev/null +++ b/SanSystem/frmExceptionWindow.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace SanSystem +{ + public partial class frmExceptionWindow : Form + { + public frmExceptionWindow() + { + InitializeComponent(); + } + } +} diff --git a/SanSystem/frmExceptionWindow.resx b/SanSystem/frmExceptionWindow.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/SanSystem/frmExceptionWindow.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/SanSystem/frmMain.cs b/SanSystem/frmMain.cs index 992c045..94f0c5b 100644 --- a/SanSystem/frmMain.cs +++ b/SanSystem/frmMain.cs @@ -37,9 +37,9 @@ namespace SanSystem { Datenbank.Instance.LoadProjekt(Global.Instance.ProjektNummer, Global.Instance.Projektpfad);// Path.Combine(Global.Instance.Projektpfad,"18-850.xaml")); } - catch(DataBaseVersionMismatchException) + catch(DataBaseVersionMismatchException ex) { - MessageBox.Show("Database version mistmatch\nProgramm wird beendet"); + MessageBox.Show("Software und Datenbank passen nicht zusammen\nProgramm wird beendet\n"+ex.Message); Environment.Exit(0); } @@ -56,12 +56,15 @@ namespace SanSystem toolStripStatus_projekt_Label.Text = Datenbank.Instance.projekt; this.Text += " " + Global.Instance.PROGRAMMVERSION; + #if (DEBUG || LAPTOP) this.Text += " INTERNE DEBUG VERSION"; #endif if (Wupi.QueryInfo(0, QueryInfoOption.FirmCode) == 0) this.Text += " nicht geschützter Version nur für TESTZWECKE!"; + + } From 28d3ea2ed20b1eb7eda6b31d591d8a702a3196ec Mon Sep 17 00:00:00 2001 From: Husky Date: Tue, 13 Aug 2019 21:25:50 +0200 Subject: [PATCH 2/3] =?UTF-8?q?Datenbank.cs=20r=C3=BCbergeholt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Database/Datenbank.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Database/Datenbank.cs b/Database/Datenbank.cs index 04e236d..92aa2b9 100644 --- a/Database/Datenbank.cs +++ b/Database/Datenbank.cs @@ -61,9 +61,9 @@ namespace Database } catch(XamlObjectWriterException ex) { - string msg = ex.Message; - if (msg.ToLower().Contains("kann nicht festgelegt werden")) - throw new DataBaseVersionMismatchException(); + if (ex.HResult.Equals(-2146233088)) + throw new DataBaseVersionMismatchException(ex.Message); + } } else From 009faaccde5583693a9a2026e27d15fdd8fc624a Mon Sep 17 00:00:00 2001 From: Husky Date: Tue, 13 Aug 2019 21:32:18 +0200 Subject: [PATCH 3/3] 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) {