diff --git a/Database/Datenbank.cs b/Database/Datenbank.cs
index 03fe903..df2522f 100644
--- a/Database/Datenbank.cs
+++ b/Database/Datenbank.cs
@@ -9,6 +9,7 @@ using System.IO.Compression;
using System.Diagnostics;
using ICSharpCode.SharpZipLib.Zip;
using ICSharpCode.SharpZipLib.Core;
+using KlassenBIB;
namespace Database
{
@@ -43,6 +44,14 @@ namespace Database
return true;
}
+ public bool InitProjekt(Projekt projekt,string projektpfad)
+ {
+ this.projektpfad = Path.Combine(projektpfad,string.Format("{0}.xaml",projekt.Nummer));
+ loadedProjekt = projekt;
+ SaveProjekt();
+ return true;
+ }
+
private void UnPackProject(string projekt, string password = "")
{
if (!Directory.Exists("./temp")) Directory.CreateDirectory("./temp");
diff --git a/SanSystem/FrmNewProjekt.Designer.cs b/SanSystem/FrmNewProjekt.Designer.cs
new file mode 100644
index 0000000..29030b0
--- /dev/null
+++ b/SanSystem/FrmNewProjekt.Designer.cs
@@ -0,0 +1,109 @@
+namespace SanSystem
+{
+ partial class FrmNewProjekt
+ {
+ ///
+ /// 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.label1 = new System.Windows.Forms.Label();
+ this.label2 = new System.Windows.Forms.Label();
+ this.txt_pro_nr = new System.Windows.Forms.TextBox();
+ this.txt_ort = new System.Windows.Forms.TextBox();
+ this.btn_save = new System.Windows.Forms.Button();
+ this.SuspendLayout();
+ //
+ // label1
+ //
+ this.label1.AutoSize = true;
+ this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.label1.Location = new System.Drawing.Point(12, 9);
+ this.label1.Name = "label1";
+ this.label1.Size = new System.Drawing.Size(116, 20);
+ this.label1.TabIndex = 0;
+ this.label1.Text = "Projektnummer";
+ //
+ // label2
+ //
+ this.label2.AutoSize = true;
+ this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.label2.Location = new System.Drawing.Point(12, 47);
+ this.label2.Name = "label2";
+ this.label2.Size = new System.Drawing.Size(31, 20);
+ this.label2.TabIndex = 1;
+ this.label2.Text = "Ort";
+ //
+ // txt_pro_nr
+ //
+ this.txt_pro_nr.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.txt_pro_nr.Location = new System.Drawing.Point(134, 3);
+ this.txt_pro_nr.Name = "txt_pro_nr";
+ this.txt_pro_nr.Size = new System.Drawing.Size(250, 26);
+ this.txt_pro_nr.TabIndex = 3;
+ //
+ // txt_ort
+ //
+ this.txt_ort.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.txt_ort.Location = new System.Drawing.Point(134, 41);
+ this.txt_ort.Name = "txt_ort";
+ this.txt_ort.Size = new System.Drawing.Size(250, 26);
+ this.txt_ort.TabIndex = 4;
+ //
+ // btn_save
+ //
+ this.btn_save.Location = new System.Drawing.Point(16, 73);
+ this.btn_save.Name = "btn_save";
+ this.btn_save.Size = new System.Drawing.Size(368, 94);
+ this.btn_save.TabIndex = 5;
+ this.btn_save.Text = "Neues Projekt anlegen";
+ this.btn_save.UseVisualStyleBackColor = true;
+ this.btn_save.Click += new System.EventHandler(this.btn_save_Click);
+ //
+ // FrmNewProjekt
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(418, 185);
+ this.Controls.Add(this.btn_save);
+ this.Controls.Add(this.txt_ort);
+ this.Controls.Add(this.txt_pro_nr);
+ this.Controls.Add(this.label2);
+ this.Controls.Add(this.label1);
+ this.Name = "FrmNewProjekt";
+ this.Text = "FrmNewProjekt";
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.Label label1;
+ private System.Windows.Forms.Label label2;
+ private System.Windows.Forms.TextBox txt_pro_nr;
+ private System.Windows.Forms.TextBox txt_ort;
+ private System.Windows.Forms.Button btn_save;
+ }
+}
\ No newline at end of file
diff --git a/SanSystem/FrmNewProjekt.cs b/SanSystem/FrmNewProjekt.cs
new file mode 100644
index 0000000..72630e9
--- /dev/null
+++ b/SanSystem/FrmNewProjekt.cs
@@ -0,0 +1,30 @@
+using KlassenBIB;
+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 FrmNewProjekt : Form
+ {
+ public FrmNewProjekt()
+ {
+ InitializeComponent();
+ }
+
+ private void btn_save_Click(object sender, EventArgs e)
+ {
+ Projekt projekt = new Projekt();
+ projekt.Nummer = txt_pro_nr.Text;
+ projekt.Ort = txt_ort.Text;
+ Global.Instance.SetProjekt(projekt);
+ //Global.Instance.ChangeProjekt(txt_pro_nr.Text);
+ }
+ }
+}
diff --git a/SanSystem/FrmNewProjekt.resx b/SanSystem/FrmNewProjekt.resx
new file mode 100644
index 0000000..1af7de1
--- /dev/null
+++ b/SanSystem/FrmNewProjekt.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/Global.cs b/SanSystem/Global.cs
index c4a6824..ca0de99 100644
--- a/SanSystem/Global.cs
+++ b/SanSystem/Global.cs
@@ -1,4 +1,5 @@
-using Microsoft.Win32;
+using KlassenBIB;
+using Microsoft.Win32;
using SanShared;
using System;
using System.Collections.Generic;
@@ -31,6 +32,17 @@ namespace SanSystem
projektpfad = value;
}
}
+
+ internal void SetProjekt(Projekt projekt)
+ {
+ Database.Datenbank.Instance.SaveProjekt();
+ this.ProjektNummer = projekt.Nummer;
+ Database.Datenbank.Instance.loadedProjekt = null;
+
+ if (!Directory.Exists(Projektpfad)) Directory.CreateDirectory(Projektpfad);
+ Database.Datenbank.Instance.InitProjekt(projekt, Projektpfad);
+ }
+
public string Projektpfad
{
get
@@ -48,6 +60,17 @@ namespace SanSystem
}
}
+ public void ChangeProjekt(string projektnummer)
+ {
+ Database.Datenbank.Instance.SaveProjekt();
+ this.ProjektNummer = projektnummer;
+ Database.Datenbank.Instance.loadedProjekt = null;
+
+ string pfad = Path.Combine(Projektpfad);
+ if (!Directory.Exists(pfad)) Directory.CreateDirectory(pfad);
+ Database.Datenbank.Instance.LoadProjekt(ProjektNummer, Projektpfad);
+ }
+
void LadeRegistry()
{
diff --git a/SanSystem/SanSystem.csproj b/SanSystem/SanSystem.csproj
index a69374d..7e2107d 100644
--- a/SanSystem/SanSystem.csproj
+++ b/SanSystem/SanSystem.csproj
@@ -76,6 +76,12 @@
FrmKalibrierungFestlegung.cs
+
+ Form
+
+
+ FrmNewProjekt.cs
+
Form
@@ -137,6 +143,9 @@
FrmKalibrierungFestlegung.cs
+
+ FrmNewProjekt.cs
+
frmObjektEdit.cs
diff --git a/SanSystem/frmMain.cs b/SanSystem/frmMain.cs
index 6c014dd..cdd28fd 100644
--- a/SanSystem/frmMain.cs
+++ b/SanSystem/frmMain.cs
@@ -51,6 +51,7 @@ namespace SanSystem
frmStrassenList strassenList = new frmStrassenList();
strassenList.MdiParent = this;
strassenList.Show();
+
//frmObjektEdit frmObjektEdit = new frmObjektEdit();
@@ -65,16 +66,38 @@ namespace SanSystem
private void neuToolStripMenuItem_Click(object sender, EventArgs e)
{
-
+ FrmNewProjekt frmNewProjekt = new FrmNewProjekt();
+ frmNewProjekt.FormClosed += FrmProjektList_FormClosed;
+ frmNewProjekt.ShowDialog();
}
private void öffnenToolStripMenuItem_Click(object sender, EventArgs e)
{
//
frmProjektList frmProjektList = new frmProjektList();
+
+ frmProjektList.FormClosed += FrmProjektList_FormClosed;
frmProjektList.ShowDialog();
}
+ private void FrmProjektList_FormClosed(object sender, FormClosedEventArgs e)
+ {
+ toolStripStatus_projekt_Label.Text = Global.Instance.ProjektNummer;
+ Form[] openedWindows = this.MdiChildren;
+ foreach(Form form in openedWindows)
+ {
+ form.Close();
+ form.Dispose();
+ }
+ frmStrassenList strassenList = new frmStrassenList();
+ strassenList.MdiParent = this;
+ strassenList.Top = 0;
+ strassenList.Left = 0;
+ strassenList.Location = new Point(0, 0);
+ strassenList.StartPosition = FormStartPosition.Manual;
+ strassenList.Show();
+ }
+
private void speichernToolStripMenuItem_Click(object sender, EventArgs e)
{
Datenbank.Instance.SaveProjekt();
diff --git a/SanSystem/frmProjektList.cs b/SanSystem/frmProjektList.cs
index 2d5b0fa..e56264e 100644
--- a/SanSystem/frmProjektList.cs
+++ b/SanSystem/frmProjektList.cs
@@ -35,6 +35,7 @@ namespace SanSystem
if(Database.Datenbank.Instance.projekt != projekt)
{
Database.Datenbank.Instance.SaveProjekt();
+ Global.Instance.ProjektNummer = projekt;
Database.Datenbank.Instance.LoadProjekt(projekt, Global.Instance.Projektpfad);
}
this.Close();