Man kann jetzt die einstellungen speichern

This commit is contained in:
Husky
2018-07-14 12:25:47 +02:00
parent 7b626f9b61
commit f7e3042daa
8 changed files with 144 additions and 6 deletions

View File

@@ -1,4 +1,5 @@
using SanShared;
using Microsoft.Win32;
using SanShared;
using System;
using System.Collections.Generic;
using System.IO;
@@ -12,9 +13,24 @@ namespace SanSystem
{
public static readonly Global instance = new Global();
const string userroot = "HKEY_CURRENT_USER\\Software";
const string firmkey = "Cosysda";
const string subkey = "SanManager";
const string speicherpfad_to_projekts = "projekte";
string projektpfad = "18-850";
string projektpfad = "18-850";
public string ProjektNummer
{
get
{
return projektpfad;
}
set
{
projektpfad = value;
}
}
public string Projektpfad
{
get
@@ -34,12 +50,24 @@ namespace SanSystem
void LadeRegistry()
{
string userroot = "HKEY_CURRENT_USER\\Software";
string firmkey = "Cosysda";
string subkey = "SanManager";
string keyName = userroot + "\\" + firmkey + "\\" + subkey;
string lastProjektNummer = "";
try
{
lastProjektNummer = Registry.GetValue(keyName, "LastProjekt", "").ToString();
ProjektNummer = lastProjektNummer;
}
catch
{ }
}
void SpeicherInRegistry()
{
string keyName = userroot + "\\" + firmkey + "\\" + subkey;
Registry.SetValue(keyName, "LastProjekt", ProjektNummer);
}
@@ -48,5 +76,15 @@ namespace SanSystem
{
language = Language.Language.GetLanguage(Language.BUILTINLANGUAGES.GERMAN);
}
public Global()
{
LadeRegistry();
}
~Global()
{
SpeicherInRegistry();
}
}
}