Projekte können nun erzeugt werden und geladen werden

This commit is contained in:
Husky
2018-07-14 20:23:22 +02:00
parent 54b637575c
commit 2be7e9857b
8 changed files with 326 additions and 2 deletions

109
SanSystem/FrmNewProjekt.Designer.cs generated Normal file
View File

@@ -0,0 +1,109 @@
namespace SanSystem
{
partial class FrmNewProjekt
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
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;
}
}

View File

@@ -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);
}
}
}

View File

@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@@ -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()
{

View File

@@ -76,6 +76,12 @@
<Compile Include="FrmKalibrierungFestlegung.Designer.cs">
<DependentUpon>FrmKalibrierungFestlegung.cs</DependentUpon>
</Compile>
<Compile Include="FrmNewProjekt.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="FrmNewProjekt.Designer.cs">
<DependentUpon>FrmNewProjekt.cs</DependentUpon>
</Compile>
<Compile Include="frmObjektEdit.cs">
<SubType>Form</SubType>
</Compile>
@@ -137,6 +143,9 @@
<EmbeddedResource Include="FrmKalibrierungFestlegung.resx">
<DependentUpon>FrmKalibrierungFestlegung.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="FrmNewProjekt.resx">
<DependentUpon>FrmNewProjekt.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="frmObjektEdit.resx">
<DependentUpon>frmObjektEdit.cs</DependentUpon>
</EmbeddedResource>

View File

@@ -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();

View File

@@ -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();