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

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

                var task = new Task(async() =>
                {
                    try
                    {
                        var items = await _departmentsService.GetAllDepartmentEmailSettingsAsync();

                        foreach (var i in items)
                        {
                            var cqi           = new CallEmailQueueItem();
                            cqi.EmailSettings = i;

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

                        _departmentsService = null;
                    }
                });

                task.Start();
            }
        }