/// <summary>
        /// Initializes a new instance of the <see cref="StartPageConfiguratorViewModel"/> class.
        /// </summary>
        public StartPageConfiguratorViewModel()
        {
            _repository = new AppSettingsRepository();
              this.AppSettings = _repository.LoadSettings();

              this.SaveConfigurationCommand = new RelayCommand<ICloseable>(null, this.SaveConfiguration);
        }
        private bool ProcessBatchTaskRunner()
        {
            var starTime       = DateTime.Now;
            var converter      = new ImageConverter(_appSettingsRepository.LoadSettings());
            int index          = 1;
            int filesToConvert = _batchItems.Count;

            foreach (var batchItem in _batchItems)
            {
                bool outputFileWritten = converter.ConvertImage(batchItem.InputFile, batchItem.OutputFile);
                if (!outputFileWritten)
                {
                    Log.Debug($"Failed to convert batchItem: {batchItem.InputFile.FileName} to {batchItem.OutputFile.FileName}");
                }

                batchItem.IsCompleted = outputFileWritten;

                // Update progress
                string text = "";

                if (outputFileWritten)
                {
                    text = $"Converted image source: {batchItem.InputFile.FileName} to destination: {batchItem.OutputFile.FilePath}";
                }
                else
                {
                    text = $"Failed to convert image source: {batchItem.InputFile.FileName} to destination: {batchItem.OutputFile.FilePath}";
                }

                if (index == _batchItems.Count)
                {
                    text += "\nCompleted image batch job.";
                }

                _progress?.Report(new ImageEncodingProgressHandler {
                    FilesCompleted = index, FileCount = filesToConvert, Text = text
                });
                index++;

                if (!runWorkerThread)
                {
                    break;
                }
            }

            TimeSpan completionTime = DateTime.Now - starTime;

            IsRunningBatch = false;
            OnBatchCompleted?.Invoke(new BatchEventArgs()
            {
                SuccessFul = true, TimeSpentProcessing = completionTime
            });
            return(true);
        }
        public ApplicationSettingsService(AppSettingsRepository appSettingsRepository)
        {
            _appSettingsRepository = appSettingsRepository;

            try
            {
                _applicationSettings = _appSettingsRepository.LoadSettings();
                if (_applicationSettings == null)
                {
                    _applicationSettings = AppSettingsRepository.GetDefaultApplicationSettings();
                    _appSettingsRepository.SaveSettings(_applicationSettings);
                }
            }
            catch (Exception ex)
            {
                Log.Error(ex, "Fatal error encountered when accessing the registry settings");
                throw new IOException("Application Settings could not be loaded and could not be set to default and saved");
            }

            _appSettingsRepository.LoadSettingsCompleted += _appSettingsFileRepository_LoadSettingsCompleted;
        }