Exemplo n.º 1
0
        public virtual ApiResult Start()
        {
            ThrowIfNotInitialized();
            Detectors.ForEach(d => QueueObserverThreads.Add(new Thread(() => ObserveDetectorQueue(d, Global.CancellationTokenSource.Token))));
            QueueObserverThreads.ForEach(t => t.Start());
            int enabled = 0;

            foreach (TDetector d in Detectors)
            {
                if (d.Enable() == ApiResult.Success)
                {
                    enabled++;
                }
                else
                {
                    Error("Could not enable detector.");
                }
            }
            if (enabled > 0)
            {
                Status = ApiStatus.Ok;
                return(ApiResult.Success);
            }
            else
            {
                Status = ApiStatus.Error;
                return(ApiResult.Failure);
            }
        }