@@ -36,15 +36,11 @@ namespace PamhagenSysCtrl {
|
||||
protected override async void OnStartup(StartupEventArgs evt) {
|
||||
Version = new Version(typeof(App).GetTypeInfo().Assembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>()?.InformationalVersion.Split('+')[0] ?? "0.0.0");
|
||||
|
||||
Plant = new(Config.PlcPort);
|
||||
try {
|
||||
Plant = new(Config.PlcPort);
|
||||
await Plant.StartThread();
|
||||
} catch (Exception exc) {
|
||||
Plant?.Dispose();
|
||||
Plant = null;
|
||||
var str = $"Beim Aufbauen einer Verbindung zur SPS ist ein Fehler aufgetreten:\n\n{exc.GetType().Name}: {exc.Message}";
|
||||
if (exc.InnerException != null) str += $"\n\n{exc.InnerException.GetType().Name}: {exc.InnerException.Message}";
|
||||
MessageBox.Show(str, "SPS-Fehler", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
// TODO
|
||||
}
|
||||
|
||||
base.OnStartup(evt);
|
||||
|
||||
Reference in New Issue
Block a user