public static bool ActivateAgLink(string?licenseKey) { try { if (!String.IsNullOrWhiteSpace(licenseKey)) { AGL4.Activate(licenseKey); Debug.WriteLine($"AgLink has been activated with license key '{licenseKey}'."); return(true); } else { Debug.WriteLine($"No license key for AgLink has been found."); return(false); } } catch { if (System.Diagnostics.Debugger.IsAttached) { System.Diagnostics.Debugger.Break(); } return(false); } }
static AgLinkPlc() { // Setup null-error mapping. AgLinkPlc.ErrorMapping = new AgLinkErrorMapping(); // Setup other AGLink properties. AGL4.ReturnJobNr(false); }
internal string GetErrorMessageForCode(int code) { this.ErrorCodeMapping.TryGetValue(code, out var message); if (String.IsNullOrWhiteSpace(message)) { AGL4.GetErrorMsg(code, out message); } if (String.IsNullOrWhiteSpace(message)) { message = $"UNKNOWN: {code} [{code:X}]"; } return(message); }