public bool Init() { try { Monitor.Enter(_ownLock); _collector.Error += ErrorMessageHandler; _collector.Info += InfoMessageHandler; _collector.Init(); _logger?.InfoLog("Initialized.", CLASS_NAME); return(IsInitialized = true); } catch (Exception ex) { IsInitialized = false; string message = _logger?.ErrorLog($"Exception occured: {ex.Message}", CLASS_NAME); ErrorMessageHandler(this, message); return(false); } finally { Monitor.Exit(_ownLock); } }