diff --git a/Database/Datenbank.cs b/Database/Datenbank.cs
index 72e3e96..8959b4e 100644
--- a/Database/Datenbank.cs
+++ b/Database/Datenbank.cs
@@ -16,7 +16,7 @@ namespace Database
{
public class Datenbank
{
- public const string pfad = "./";
+ public string pfad;
public string projekt;
public static readonly Datenbank instance = new Datenbank();
public static Datenbank Instance
@@ -27,18 +27,27 @@ namespace Database
}
}
+ public void Init()
+ {
+ TeufelDB = new KlassenBIB.DB();
+ string filepath = "";
+ filepath = Path.Combine(pfad, "projekte", "TeufelDB.xaml");
+
+ if(!Directory.Exists(Path.Combine(pfad,"projekte")))
+ {
+ Directory.CreateDirectory(Path.Combine(pfad, "projekte"));
+ return;
+ }
+ if (File.Exists(filepath))
+ TeufelDB = XamlServices.Load(filepath) as KlassenBIB.DB;
+ }
+
public KlassenBIB.Projekt loadedProjekt = null;
//public KlassenBIB.MainDataBase MainDatenbank = null;
public KlassenBIB.DB TeufelDB = null;
public Datenbank()
- {
- TeufelDB = new KlassenBIB.DB();
- string filepath = "";
- filepath = Path.Combine("./projekte", "TeufelDB.xaml");
- if(File.Exists(filepath))
- TeufelDB = XamlServices.Load("./projekte/TeufelDB.xaml") as KlassenBIB.DB;
-
+ {
}
@@ -48,7 +57,8 @@ namespace Database
this.projekt = projekt;
loadedProjekt = Datenbank.Instance.TeufelDB.Projekte.Find(x => x.Nummer != null && x.Nummer.Equals(projekt));
- if (!File.Exists("./projekte/TeufelDB.xaml"))
+ string filepath = Path.Combine(pfad, "projekte", "TeufelDB.xaml");
+ if (!File.Exists(filepath))
{
UpdateDatabase.UpdateNewGuids();
@@ -72,7 +82,9 @@ namespace Database
public void SaveProjekt()
{
- XamlServices.Save("./projekte/TeufelDB.xaml", TeufelDB);
+ string filepath = Path.Combine(pfad, "projekte", "TeufelDB.xaml");
+ Trace.WriteLine(filepath);
+ XamlServices.Save(filepath, TeufelDB);
}
}
}
diff --git a/SanSystem/App.config b/SanSystem/App.config
index c10ef65..6aff5be 100644
--- a/SanSystem/App.config
+++ b/SanSystem/App.config
@@ -1,5 +1,10 @@
+
+
+
+
+
@@ -19,4 +24,11 @@
+
+
+
+ C:\
+
+
+
diff --git a/SanSystem/Global.cs b/SanSystem/Global.cs
index 192ece8..317006f 100644
--- a/SanSystem/Global.cs
+++ b/SanSystem/Global.cs
@@ -75,7 +75,7 @@ namespace SanSystem
{
get
{
- return Path.Combine(speicherpfad_to_projekts, projektpfad);
+ return Path.Combine(Properties.Settings.Default.DATABASEMAIN,speicherpfad_to_projekts, projektpfad);
}
}
public ILanguage language = null;
diff --git a/SanSystem/Properties/Settings.Designer.cs b/SanSystem/Properties/Settings.Designer.cs
index a100b1f..1c3f239 100644
--- a/SanSystem/Properties/Settings.Designer.cs
+++ b/SanSystem/Properties/Settings.Designer.cs
@@ -22,5 +22,17 @@ namespace SanSystem.Properties {
return defaultInstance;
}
}
+
+ [global::System.Configuration.UserScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("C:\\")]
+ public string DATABASEMAIN {
+ get {
+ return ((string)(this["DATABASEMAIN"]));
+ }
+ set {
+ this["DATABASEMAIN"] = value;
+ }
+ }
}
}
diff --git a/SanSystem/Properties/Settings.settings b/SanSystem/Properties/Settings.settings
index 3964565..fb30c22 100644
--- a/SanSystem/Properties/Settings.settings
+++ b/SanSystem/Properties/Settings.settings
@@ -1,7 +1,9 @@
-
-
-
-
-
-
+
+
+
+
+ C:\
+
+
+
\ No newline at end of file
diff --git a/SanSystem/frmMain.cs b/SanSystem/frmMain.cs
index abeec2f..c2586e0 100644
--- a/SanSystem/frmMain.cs
+++ b/SanSystem/frmMain.cs
@@ -30,8 +30,11 @@ namespace SanSystem
public frmMain()
{
InitializeComponent();
-
-
+ string sx = Properties.Settings.Default.DATABASEMAIN;
+
+
+ Datenbank.Instance.pfad = sx;
+ Datenbank.Instance.Init();
if (!Directory.Exists(Global.Instance.Projektpfad)) Directory.CreateDirectory(Global.Instance.Projektpfad);
try
{