Compare commits
7 Commits
XML_Export
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| e7891c1a05 | |||
| c5a2a15865 | |||
| f867ef6222 | |||
| 778b4a9a64 | |||
| ba3e10fd2d | |||
| e54b875f1a | |||
| 16ac432831 |
@@ -99,9 +99,10 @@ namespace SewerStammGen.DAL.Services.PostgresqlData
|
|||||||
|
|
||||||
public async Task<Schacht> Update(Schacht entity)
|
public async Task<Schacht> Update(Schacht entity)
|
||||||
{
|
{
|
||||||
|
// TODO: Typo in Schachtype beheben. Dies erfordert jedoch ein Datenbank updater Siehe Issue #7
|
||||||
string command = @"UPDATE " + tableName + " SET " +
|
string command = @"UPDATE " + tableName + " SET " +
|
||||||
"objektbezeichnung=@1, deckelrechtswert=@2, deckelhochwert=@3, deckelhoehe=@4, " +
|
"objektbezeichnung=@1, deckelrechtswert=@2, deckelhochwert=@3, deckelhoehe=@4, " +
|
||||||
"sohlrechtswert=@5, sohlhochwert=@6, sohlhoehe=@7, entwaesserung=@8, schachttype=@9, vermesser=@10, aufnahmedatum=@11, ref_projekt_id=@12 WHERE schacht_id=@13";
|
"sohlrechtswert=@5, sohlhochwert=@6, sohlhoehe=@7, entwaesserung=@8, schachtype=@9, vermesser=@10, aufnahmedatum=@11, ref_projekt_id=@12 WHERE schacht_id=@13";
|
||||||
using(var cmd = new NpgsqlCommand(command,conn))
|
using(var cmd = new NpgsqlCommand(command,conn))
|
||||||
{
|
{
|
||||||
cmd.Parameters.AddWithValue("1", entity.Objektbezeichnung);
|
cmd.Parameters.AddWithValue("1", entity.Objektbezeichnung);
|
||||||
|
|||||||
@@ -12,4 +12,8 @@
|
|||||||
<None Remove="Services\**" />
|
<None Remove="Services\**" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Wibu.CodeMeter.WibuCmNET" Version="7.60.5615.502" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
203
SewerStammGen.Shared/WWRuntime.cs
Normal file
203
SewerStammGen.Shared/WWRuntime.cs
Normal file
@@ -0,0 +1,203 @@
|
|||||||
|
using CodeMeter;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace SewerStammGen.Shared
|
||||||
|
{
|
||||||
|
public class DongleNotFoundException : Exception
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public class WWRuntime : IDisposable
|
||||||
|
{
|
||||||
|
uint FirmCode;
|
||||||
|
uint ProductCode;
|
||||||
|
|
||||||
|
Api cmApi;
|
||||||
|
CmCredential cmCred;
|
||||||
|
CmAccess2 cmAcc;
|
||||||
|
HCMSysEntry hcmse;
|
||||||
|
CmBoxInfo cmBoxInfo;
|
||||||
|
CmBoxEntry2? BoxContent;
|
||||||
|
|
||||||
|
uint ExportCount;
|
||||||
|
|
||||||
|
public WWRuntime(uint ProductCode)
|
||||||
|
{
|
||||||
|
this.ProductCode = ProductCode;
|
||||||
|
FirmCode = 103086;
|
||||||
|
|
||||||
|
cmApi = new Api();
|
||||||
|
cmCred = new CmCredential();
|
||||||
|
cmAcc = new CmAccess2();
|
||||||
|
|
||||||
|
cmAcc.Credential = cmCred;
|
||||||
|
cmAcc.Ctrl |= CmAccess.Option.UserLimit;
|
||||||
|
cmAcc.FirmCode = FirmCode;
|
||||||
|
cmAcc.ProductCode = ProductCode;
|
||||||
|
|
||||||
|
hcmse = cmApi.CmAccess2(CmAccessOption.Local, cmAcc);
|
||||||
|
if(hcmse == null)
|
||||||
|
{
|
||||||
|
ErrorCodes2 code = cmApi.CmGetLastErrorCode2();
|
||||||
|
throw new DongleNotFoundException();
|
||||||
|
}
|
||||||
|
|
||||||
|
cmBoxInfo = new CmBoxInfo();
|
||||||
|
|
||||||
|
CmGetBoxContentsOption boxOptions = new CmGetBoxContentsOption();
|
||||||
|
boxOptions = CmGetBoxContentsOption.AllEntries;
|
||||||
|
CmBoxEntry2[] tmpBoxContent;
|
||||||
|
|
||||||
|
tmpBoxContent = cmApi.CmGetBoxContents2(hcmse, boxOptions, this.FirmCode, cmBoxInfo);
|
||||||
|
|
||||||
|
CmEntryData[] pCmBoxEntry = (CmEntryData[])cmApi.CmGetInfo(hcmse, CmGetInfoOption.EntryData);
|
||||||
|
for (int i = 0; i < pCmBoxEntry.Length; i++)
|
||||||
|
{
|
||||||
|
switch (pCmBoxEntry[i].Ctrl & 0x0ffff)
|
||||||
|
{
|
||||||
|
case (uint)CodeMeter.GlobalEntryOption.UserData:
|
||||||
|
{
|
||||||
|
|
||||||
|
ExportCount = BitConverter.ToUInt32(pCmBoxEntry[i].Data);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case (uint)CodeMeter.GlobalEntryOption.ProtectedData:
|
||||||
|
// Transfer to transformed byte
|
||||||
|
uint length = pCmBoxEntry[i].DataLen;
|
||||||
|
byte[] datas = new byte[length];
|
||||||
|
for (uint f = 0; f < length; f++)
|
||||||
|
{
|
||||||
|
datas[f] = pCmBoxEntry[i].Data[f];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//SyncfusionKey = Encoding.ASCII.GetString(datas);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (CmBoxEntry2 boxes in tmpBoxContent)
|
||||||
|
{
|
||||||
|
if (boxes.ProductCode == this.ProductCode)
|
||||||
|
{
|
||||||
|
this.BoxContent = boxes;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsLicensed(byte neededMask)
|
||||||
|
{
|
||||||
|
uint DongleFeature = GetFeatureMap();
|
||||||
|
byte DongleFeatureB = (byte)DongleFeature;
|
||||||
|
|
||||||
|
if ((DongleFeatureB & neededMask) == neededMask)
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private uint GetFeatureMap()
|
||||||
|
{
|
||||||
|
if (BoxContent == null) return 0;
|
||||||
|
return BoxContent.FeatureMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
string GetDongleSerial()
|
||||||
|
{
|
||||||
|
CmBoxInfo res = (CmBoxInfo)cmApi.CmGetInfo(hcmse, CmGetInfoOption.BoxInfo);
|
||||||
|
if (null != res)
|
||||||
|
{
|
||||||
|
return res.SerialNumber.ToString();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new Exception("Fehler beim aufrufen der Seriennummer");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int GetExportCount()
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void IncrementExportCounter()
|
||||||
|
{
|
||||||
|
ExportCount++;
|
||||||
|
writeExportCount(ExportCount);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool CheckDongleVorhanden()
|
||||||
|
{
|
||||||
|
return hcmse != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void CleanDongle()
|
||||||
|
{
|
||||||
|
cmApi.CmRelease(hcmse);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void writeExportCount(uint count)
|
||||||
|
{
|
||||||
|
CmCreatePioUserData cmCreatePioUserData = new CmCreatePioUserData();
|
||||||
|
CmProgramUpdateProductItem pcmUpdateProductItem = new CmProgramUpdateProductItem();
|
||||||
|
CmCreateItem hcmCreateItem = new CmCreateItem();
|
||||||
|
object pvPio = new object();
|
||||||
|
|
||||||
|
CmInternalEntryInfo[] cmInternalEntryData;
|
||||||
|
cmInternalEntryData = (CmInternalEntryInfo[])cmApi.CmGetInfo(hcmse, CmGetInfoOption.InternalEntryInfo);
|
||||||
|
|
||||||
|
byte[] newCount = BitConverter.GetBytes(count);
|
||||||
|
newCount.CopyTo(cmCreatePioUserData.Data, 0);
|
||||||
|
cmCreatePioUserData.DataLen = (ushort)newCount.Length;
|
||||||
|
pvPio = cmCreatePioUserData;
|
||||||
|
|
||||||
|
CmCreatePioProductCode cmPC = new CmCreatePioProductCode();
|
||||||
|
cmPC.TvbCtrl = (CmCreatePioProductCode.Option)0;
|
||||||
|
cmPC.ProductCode = ProductCode;
|
||||||
|
cmPC.FirmItemReference = cmInternalEntryData[0].FirmItemReference;
|
||||||
|
cmPC.ProductItemReference = cmInternalEntryData[0].ProductItemReference;
|
||||||
|
|
||||||
|
string? error;
|
||||||
|
|
||||||
|
bool res = cmApi.CmCreateProductItemOption(hcmse, CmCreateProductItemOptionOption.Update | CmCreateProductItemOptionOption.ProductCode, cmPC);
|
||||||
|
if(!res)
|
||||||
|
{
|
||||||
|
error = cmApi.CmGetLastErrorText();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
res = cmApi.CmCreateProductItemOption(hcmse, CmCreateProductItemOptionOption.UserData | CmCreateProductItemOptionOption.Terminate, pvPio);
|
||||||
|
if(!res)
|
||||||
|
{
|
||||||
|
error = cmApi.CmGetLastErrorText();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
hcmCreateItem.FirmCode = 103086;
|
||||||
|
hcmCreateItem.ProductCode = ProductCode;
|
||||||
|
|
||||||
|
|
||||||
|
byte[] sequence = cmApi.CmCreateSequence(hcmse, GlobalProgrammingOption.UpdateProductItem, ref hcmCreateItem, pcmUpdateProductItem);
|
||||||
|
|
||||||
|
res = cmApi.CmProgram(hcmse, GlobalProgrammingOption.UpdateProductItem, sequence);
|
||||||
|
|
||||||
|
if (!res)
|
||||||
|
{
|
||||||
|
error = cmApi.CmGetLastErrorText();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
CleanDongle();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -9,6 +9,10 @@ using System.Data;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
|
using CodeMeter;
|
||||||
|
using SewerStammGen.Shared;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Windows.Threading;
|
||||||
|
|
||||||
namespace StammGenerator
|
namespace StammGenerator
|
||||||
{
|
{
|
||||||
@@ -20,7 +24,27 @@ namespace StammGenerator
|
|||||||
private readonly IHost _host;
|
private readonly IHost _host;
|
||||||
public App()
|
public App()
|
||||||
{
|
{
|
||||||
_host = CreateHostBuilder().Build();
|
new Mutex(initiallyOwned: true, "Stammdatengenerator", out bool result);
|
||||||
|
if(!result)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Bitte nur 1 Instanz der Software Starten!","Fehler", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||||
|
Environment.Exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
using (WWRuntime wWRuntime = new WWRuntime(21))
|
||||||
|
{
|
||||||
|
if(wWRuntime.CheckDongleVorhanden())
|
||||||
|
{
|
||||||
|
wWRuntime.CleanDongle();
|
||||||
|
_host = CreateHostBuilder().Build();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MessageBox.Show("Kein Dongle gefunden");
|
||||||
|
Environment.Exit(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static IHostBuilder CreateHostBuilder(string[]? args = null)
|
static IHostBuilder CreateHostBuilder(string[]? args = null)
|
||||||
@@ -34,14 +58,35 @@ namespace StammGenerator
|
|||||||
|
|
||||||
protected override void OnStartup(StartupEventArgs e)
|
protected override void OnStartup(StartupEventArgs e)
|
||||||
{
|
{
|
||||||
|
if (_host == null) return;
|
||||||
|
|
||||||
|
Application.Current.DispatcherUnhandledException += Current_DispatcherUnhandledException;
|
||||||
|
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
|
||||||
_host.Start();
|
_host.Start();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
MainWindow? window = new MainWindow() { DataContext = _host.Services.GetRequiredService<MainWindowViewModel>() };
|
MainWindow? window = new MainWindow() { DataContext = _host.Services.GetRequiredService<MainWindowViewModel>() };
|
||||||
window.Show();
|
window.Show();
|
||||||
|
|
||||||
base.OnStartup(e);
|
base.OnStartup(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Exception ex = (Exception)e.ExceptionObject;
|
||||||
|
string text = "Ein Software fehler ist Aufgetreten. Bitte kontaktiere uns mit folgende Information:\n\n";
|
||||||
|
MessageBox.Show(text + " " + ex.Message + "\n\n" + ex.StackTrace);
|
||||||
|
}
|
||||||
|
catch (Exception ex2)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Fatal Non-UI error", ex2.Message, MessageBoxButton.OK, MessageBoxImage.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Current_DispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using SewerStammGen.Shared.Contracts;
|
using SewerStammGen.Shared;
|
||||||
|
using SewerStammGen.Shared.Contracts;
|
||||||
using SewerStammGen.Shared.Domain;
|
using SewerStammGen.Shared.Domain;
|
||||||
using Shared.Contracts;
|
using Shared.Contracts;
|
||||||
using StammGenerator.Commands;
|
using StammGenerator.Commands;
|
||||||
@@ -6,6 +7,7 @@ using StammGenerator.ViewModel;
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
@@ -39,13 +41,21 @@ namespace StammGenerator.Commands
|
|||||||
IExport export = ExporterFactory.Export(_selectedProjekt.ExportType);
|
IExport export = ExporterFactory.Export(_selectedProjekt.ExportType);
|
||||||
IEnumerable<Kanal> haltungen = await _haltungDataService.GetAllByProjekt(_selectedProjekt);
|
IEnumerable<Kanal> haltungen = await _haltungDataService.GetAllByProjekt(_selectedProjekt);
|
||||||
IEnumerable<Schacht> schaechte = await _schachtDataService.GetAllByProjekt(_selectedProjekt);
|
IEnumerable<Schacht> schaechte = await _schachtDataService.GetAllByProjekt(_selectedProjekt);
|
||||||
|
if(!Directory.Exists("./export/"))
|
||||||
|
{
|
||||||
|
Directory.CreateDirectory("./export/");
|
||||||
|
}
|
||||||
|
|
||||||
await export.Export(_selectedProjekt.Id.ToString(), _selectedProjekt.Kodierungssystem, haltungen.ToList(), schaechte.ToList(), wwLog);
|
await export.Export("./export/"+_selectedProjekt.Id.ToString(), _selectedProjekt.Kodierungssystem, haltungen.ToList(), schaechte.ToList(), wwLog);
|
||||||
}
|
}
|
||||||
catch(NotImplementedException)
|
catch(NotImplementedException)
|
||||||
{
|
{
|
||||||
MessageBoxResult result = MessageBox.Show(string.Format("Schnittstelle Export format: {0} ist nicht Implementiert", _selectedProjekt.ExportType), "Fehlende Implementation", MessageBoxButton.OK, MessageBoxImage.Exclamation);
|
MessageBoxResult result = MessageBox.Show(string.Format("Schnittstelle Export format: {0} ist nicht Implementiert", _selectedProjekt.ExportType), "Fehlende Implementation", MessageBoxButton.OK, MessageBoxImage.Exclamation);
|
||||||
}
|
}
|
||||||
|
catch(DongleNotFoundException)
|
||||||
|
{
|
||||||
|
MessageBoxResult result = MessageBox.Show("Dongle nicht vorhanden");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ namespace StammGenerator.Converters
|
|||||||
if (targetType == typeof(EEntwaeserung)) return (EEntwaeserung)parameter;
|
if (targetType == typeof(EEntwaeserung)) return (EEntwaeserung)parameter;
|
||||||
if (targetType == typeof(EExportType)) return (EExportType)parameter;
|
if (targetType == typeof(EExportType)) return (EExportType)parameter;
|
||||||
if (targetType == typeof(EKodierungssystem)) return (EKodierungssystem)parameter;
|
if (targetType == typeof(EKodierungssystem)) return (EKodierungssystem)parameter;
|
||||||
|
if (targetType == typeof(ESchachtType)) return (ESchachtType)parameter;
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:local="clr-namespace:StammGenerator"
|
xmlns:local="clr-namespace:StammGenerator"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
|
WindowState="Maximized"
|
||||||
xmlns:view="clr-namespace:StammGenerator.Views"
|
xmlns:view="clr-namespace:StammGenerator.Views"
|
||||||
xmlns:viewmodel="clr-namespace:StammGenerator.ViewModel"
|
xmlns:viewmodel="clr-namespace:StammGenerator.ViewModel"
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.1" />
|
<PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.1" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="7.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="7.0.0" />
|
||||||
|
<PackageReference Include="Wibu.CodeMeter.WibuCmNET" Version="7.60.5615.502" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ namespace StammGenerator.ViewModel
|
|||||||
private readonly IActualState _actualState;
|
private readonly IActualState _actualState;
|
||||||
private readonly IHaltungDataService _haltungDataService;
|
private readonly IHaltungDataService _haltungDataService;
|
||||||
private readonly ISchachtDataService _schachtDataService;
|
private readonly ISchachtDataService _schachtDataService;
|
||||||
private List<Schacht> avaibleSchaechte;
|
private List<Schacht> avaibleSchaechte = new List<Schacht>();
|
||||||
private int _selectedObenIndex;
|
private int _selectedObenIndex;
|
||||||
private int _selectedUntenIndex;
|
private int _selectedUntenIndex;
|
||||||
private Kanal _model;
|
private Kanal _model;
|
||||||
@@ -52,6 +52,7 @@ namespace StammGenerator.ViewModel
|
|||||||
_selectedObenIndex = value;
|
_selectedObenIndex = value;
|
||||||
_model.StartSchacht = avaibleSchaechte[value];
|
_model.StartSchacht = avaibleSchaechte[value];
|
||||||
RecalculateLength();
|
RecalculateLength();
|
||||||
|
Haltungsbezeichnung = _model.StartSchacht.Objektbezeichnung;
|
||||||
OnPropertyChanged();
|
OnPropertyChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,18 +42,12 @@ namespace StammGenerator.ViewModel
|
|||||||
UpdateCurrentViewModelCommand.Execute(EMainWindowViewType.Home);
|
UpdateCurrentViewModelCommand.Execute(EMainWindowViewType.Home);
|
||||||
|
|
||||||
_actualState = actualState;
|
_actualState = actualState;
|
||||||
|
|
||||||
|
|
||||||
_actualState.ProjektChanged += ActualState_ProjektChanged;
|
_actualState.ProjektChanged += ActualState_ProjektChanged;
|
||||||
|
_actualState.LoadLastProjekt();
|
||||||
|
|
||||||
Navigator.StateChanged += Navigator_StateChanged;
|
Navigator.StateChanged += Navigator_StateChanged;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#if DEBUG
|
|
||||||
|
|
||||||
_actualState.SetProjekt(new Projekt() { Id = 5 });
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ActualState_ProjektChanged(object? sender, EventArgs e)
|
private void ActualState_ProjektChanged(object? sender, EventArgs e)
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using SewerStammGen.Shared.Domain;
|
using Microsoft.Win32;
|
||||||
|
using SewerStammGen.Shared.Domain;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@@ -9,6 +10,10 @@ namespace StammGenerator.ViewModel
|
|||||||
{
|
{
|
||||||
internal class ActualState : IActualState
|
internal class ActualState : IActualState
|
||||||
{
|
{
|
||||||
|
const string userroot = "HKEY_CURRENT_USER\\Software";
|
||||||
|
const string firmkey = "WWTech";
|
||||||
|
const string subkey = "StammGenerator";
|
||||||
|
|
||||||
// TODO: set auf private set setzen
|
// TODO: set auf private set setzen
|
||||||
public int ProjektID { get; set; }
|
public int ProjektID { get; set; }
|
||||||
|
|
||||||
@@ -25,6 +30,9 @@ namespace StammGenerator.ViewModel
|
|||||||
{
|
{
|
||||||
OnProjektChanged();
|
OnProjektChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
string keyName = userroot + "\\" + firmkey + "\\" + subkey;
|
||||||
|
Registry.SetValue(keyName, "LastProjekt", ProjektID);
|
||||||
}
|
}
|
||||||
public void SetSchacht(Schacht schacht, bool notification = true)
|
public void SetSchacht(Schacht schacht, bool notification = true)
|
||||||
{
|
{
|
||||||
@@ -61,6 +69,17 @@ namespace StammGenerator.ViewModel
|
|||||||
{
|
{
|
||||||
HaltungChanged?.Invoke(this, new EventArgs());
|
HaltungChanged?.Invoke(this, new EventArgs());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void LoadLastProjekt()
|
||||||
|
{
|
||||||
|
string keyName = userroot + "\\" + firmkey + "\\" + subkey;
|
||||||
|
if(Registry.GetValue(keyName,"LastProjekt","")!= null)
|
||||||
|
{
|
||||||
|
ProjektID = Convert.ToInt32(Registry.GetValue(keyName, "LastProjekt", ""));
|
||||||
|
OnProjektChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,5 +20,7 @@ namespace StammGenerator.ViewModel
|
|||||||
void SetProjekt(Projekt projekt, bool notification = true);
|
void SetProjekt(Projekt projekt, bool notification = true);
|
||||||
void SetSchacht(Schacht schacht, bool notification = true);
|
void SetSchacht(Schacht schacht, bool notification = true);
|
||||||
void SetHaltung(Kanal haltung, bool notification = true);
|
void SetHaltung(Kanal haltung, bool notification = true);
|
||||||
|
|
||||||
|
void LoadLastProjekt();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,6 @@
|
|||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
d:DesignHeight="450" d:DesignWidth="800">
|
d:DesignHeight="450" d:DesignWidth="800">
|
||||||
<Grid>
|
<Grid>
|
||||||
<TextBlock Text="Willkommen dieses Programm generiert Stammdaten für die TV Inspektion" />
|
<TextBlock Text="Version Test - 0.1" />
|
||||||
</Grid>
|
</Grid>
|
||||||
</UserControl>
|
</UserControl>
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using SewerStammGen.Shared.Domain;
|
using SewerStammGen.Shared;
|
||||||
|
using SewerStammGen.Shared.Domain;
|
||||||
using SewerStammGen.Shared.Enum;
|
using SewerStammGen.Shared.Enum;
|
||||||
using Shared.Contracts;
|
using Shared.Contracts;
|
||||||
using System;
|
using System;
|
||||||
@@ -16,6 +17,15 @@ namespace WWTech_KanalSchnittstelle.Exporter
|
|||||||
{
|
{
|
||||||
public static IExport Export(EExportType exportType)
|
public static IExport Export(EExportType exportType)
|
||||||
{
|
{
|
||||||
|
using(WWRuntime wWRuntime = new WWRuntime(21))
|
||||||
|
{
|
||||||
|
if(!wWRuntime.CheckDongleVorhanden())
|
||||||
|
{
|
||||||
|
throw new DongleNotFoundException();
|
||||||
|
}
|
||||||
|
wWRuntime.IncrementExportCounter();
|
||||||
|
wWRuntime.CleanDongle();
|
||||||
|
}
|
||||||
switch(exportType)
|
switch(exportType)
|
||||||
{
|
{
|
||||||
case EExportType.KANDIS6: return new KANDIS60();
|
case EExportType.KANDIS6: return new KANDIS60();
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ namespace WWTech_KanalSchnittstelle.Exporter.XML
|
|||||||
DoAdmindata(xmlElement);
|
DoAdmindata(xmlElement);
|
||||||
DoCollectives(xmlElement);
|
DoCollectives(xmlElement);
|
||||||
|
|
||||||
_file.Save("test.xml");
|
_file.Save(projektname+".xml");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ namespace WWTech_KanalSchnittstelle.Exporter.XML
|
|||||||
DoAdmindata(xmlElement);
|
DoAdmindata(xmlElement);
|
||||||
DoCollectives(xmlElement);
|
DoCollectives(xmlElement);
|
||||||
|
|
||||||
_file.Save("test.xml");
|
_file.Save(projektname + ".xml");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ namespace WWTech_KanalSchnittstelle.Exporter.XML
|
|||||||
DoAdmindata(xmlElement);
|
DoAdmindata(xmlElement);
|
||||||
DoCollectives(xmlElement);
|
DoCollectives(xmlElement);
|
||||||
|
|
||||||
_file.Save("test.xml");
|
_file.Save(projektname + ".xml");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ namespace WWTech_KanalSchnittstelle.Importer
|
|||||||
schacht.SohlHoehe = parseKoordinate(parsed[3]);
|
schacht.SohlHoehe = parseKoordinate(parsed[3]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (parsed.Length >= 4)
|
if (parsed.Length > 4)
|
||||||
{
|
{
|
||||||
schacht.Entwaesserung = entwaesserungKennung[parsed[4]];
|
schacht.Entwaesserung = entwaesserungKennung[parsed[4]];
|
||||||
schacht.SchachtType = schachtKennung[parsed[4]];
|
schacht.SchachtType = schachtKennung[parsed[4]];
|
||||||
|
|||||||
Reference in New Issue
Block a user