Dongle abfrage hinzugefügt

This commit is contained in:
2023-08-06 16:24:27 +02:00
parent 28ad24751d
commit 16ac432831
7 changed files with 251 additions and 6 deletions

View File

@@ -9,6 +9,9 @@ using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
using CodeMeter;
using SewerStammGen.Shared;
using System.Threading;
namespace StammGenerator
{
@@ -20,7 +23,27 @@ namespace StammGenerator
private readonly IHost _host;
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)
@@ -34,10 +57,9 @@ namespace StammGenerator
protected override void OnStartup(StartupEventArgs e)
{
if (_host == null) return;
_host.Start();
MainWindow? window = new MainWindow() { DataContext = _host.Services.GetRequiredService<MainWindowViewModel>() };
window.Show();

View File

@@ -1,4 +1,5 @@
using SewerStammGen.Shared.Contracts;
using SewerStammGen.Shared;
using SewerStammGen.Shared.Contracts;
using SewerStammGen.Shared.Domain;
using Shared.Contracts;
using StammGenerator.Commands;
@@ -46,6 +47,10 @@ namespace StammGenerator.Commands
{
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");
}
}
}
}

View File

@@ -10,6 +10,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.1" />
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="7.0.0" />
<PackageReference Include="Wibu.CodeMeter.WibuCmNET" Version="7.60.5615.502" />
</ItemGroup>
<ItemGroup>