public bool Initialize() { _setting = new SettingHook(); try { _dbConnection = _setting.GetDatabaseConnectionString(); _traceabilityIsEnabled = _setting.GetEnableTraceability(); _machineSerialNumber = _setting.MachineSerialNumber(); _uniqueIdLength = _setting.GetUniqueIdLength(); _allowCrossWorkOrder = _setting.GetAllowCrossWorkOrder(); } catch (Exception exception) { MachineHookException?.Invoke(exception.Message); return(false); } var result = GetMachineBySerialNumber(_machineSerialNumber, _dbConnection, out _thisMachine); return(CheckIfInitialized()); }