예제 #1
0
        public void PopulateQueue()
        {
            if (!_isLocked)
            {
                _isLocked = true;
                Clear();

                _departmentsService = Bootstrapper.GetKernel().Resolve <IDepartmentsService>();

                var t1 = new Task(() =>
                {
                    try
                    {
                        var items = _departmentsService.GetAllDepartmentCallPrunings();

                        foreach (var i in items)
                        {
                            var item           = new CallPruneQueueItem();
                            item.PruneSettings = i;

                            _queue.Enqueue(item);
                        }
                    }
                    catch (Exception ex)
                    {
                        Logging.LogException(ex);
                    }
                    finally
                    {
                        _isLocked = false;
                        _cleared  = false;

                        _departmentsService = null;
                    }
                });

                t1.Start();
            }
        }