/// <summary> /// Initialize the Clover Device for use /// </summary> /// <param name="configuration"></param> public virtual void Initialize(CloverDeviceConfiguration configuration) { string logSource = "_TransportEventLog"; if (!EventLog.SourceExists(logSource)) { EventLog.CreateEventSource(logSource, logSource); } // Add the event log trace listener to the collection. EventLogTraceListener myTraceListener = new EventLogTraceListener(logSource); Trace.Listeners.Add(myTraceListener); transport = configuration.getCloverTransport(); shortTransportType = !string.IsNullOrWhiteSpace(transport.ShortTitle()) ? transport.ShortTitle() : shortTransportType; packageName = configuration.getMessagePackageName(); remoteSourceSDK = getSDKInfoString(); deviceInfo = new DeviceInfo(); }
/// <summary> /// Initialize the Clover Device for use /// </summary> /// <param name="configuration"></param> public virtual void Initialize(CloverDeviceConfiguration configuration) { string logSource = "_TransportEventLog"; try { // If this EventLog code crashes, you don't have the Windows Event Log Source setup, and this code isn't running with sufficient credentials to create it. // See https://github.com/clover/remote-pay-windows/wiki/ "Setting up the Windows Event Log" article for details. // // Quickfixs: run this app _once_ as admin so this code can perform setup, or just run this in an admin PowerShell> New-EventLog -LogName "Application" -Source "_TransportEventLog" // Other fixes available in the project's wiki article. // // When this app is deployed into production, the installer or deploy script should ensure the EventLog is created. if (!EventLog.SourceExists(logSource)) { EventLog.CreateEventSource(logSource, logSource); } // Add the event log trace listener to the collection. EventLogTraceListener eventlog = new EventLogTraceListener(logSource); Trace.Listeners.Add(eventlog); } catch (Exception exception) { // If this has crashed, see the comment just above at the top of the EventLog try for details and quick fixes. throw new CloverException($"Aborting Clover Connector SDK because the Windows Event Log Source \"{logSource}\" does not exist or cannot be accessed.\nSee the https://github.com/clover/remote-pay-windows/wiki article for more information.\n\nref# CLOVER-W230\nDetail Message: {exception.Message}", "CLOVER-W230", exception); } Log(MessageLevel.Detailed, $"CloverDevice.{nameof(Initialize)} {configuration.getName()}, raid: {configuration.getRemoteApplicationID()}"); transport = configuration.getCloverTransport(); transport?.SetLogLevel(logLevel); shortTransportType = !string.IsNullOrWhiteSpace(transport.ShortTitle()) ? transport.ShortTitle() : shortTransportType; packageName = configuration.getMessagePackageName(); remoteSourceSDK = getSDKInfoString(); deviceInfo = new DeviceInfo(); }
public DefaultCloverDevice(CloverDeviceConfiguration configuration) : this(configuration.getMessagePackageName(), configuration.getCloverTransport(), configuration.getRemoteApplicationID()) { }