public MainWindowViewModel(Window owner)
        {
            if (owner == null)
                throw new ArgumentNullException("owner");

            Owner = owner;

            _searchCommand = new SearchCommand(this);
            _browseCommand = new BrowseCommand(this);
            _saveCommand = new SaveCommand(this);
            _settingsCommand = new SettingsCommand(this);

            // load all enabled scrapers
            _scrapers = ScraperLoader.Instance.EnabledScrapers;

            if (!string.IsNullOrEmpty(Properties.Settings.Default.SelectedScraper))
                CurrentScraper = _scrapers.FirstOrDefault(s => s.Name == Properties.Settings.Default.SelectedScraper);

            if (CurrentScraper == null)
                CurrentScraper = _scrapers.First();

            // load output path from user settings
            _outputPath = Properties.Settings.Default.OutputPath;

            Mangas = new AsyncObservableCollection<MangaRecord>();
            Chapters = new AsyncObservableCollection<ChapterRecord>();
            Downloads = new AsyncObservableCollection<DownloadViewModel>();
            SelectedChapters = new AsyncObservableCollection<ChapterRecord>();

            ZipFile = true;
            ProgressValue = 0;

            _requestQueue = new AsyncRequestQueue(System.Threading.SynchronizationContext.Current);
            _requestQueue.TasksCompleted += _requestQueue_TasksCompleted;
            _requestQueue.Initialize();

            _downloadsSemaphore = new FifoSemaphore(Properties.Settings.Default.MaxParallelDownloads);

            if (Properties.Settings.Default.EnablePreload)
            {
                PreloadMangas();
            }
        }
        public MainWindowViewModel()
        {
            _searchCommand = new RelayCommand(SearchManga);
            _browseCommand = new RelayCommand(BrowseClicked);
            _saveCommand = new RelayCommand(SaveClicked);

            // load output path from user settings
            _outputPath = Properties.Settings.Default.OutputPath;

            Mangas = new AsyncObservableCollection<IMangaRecord>();
            Chapters = new AsyncObservableCollection<ChapterViewModel>();
            SelectedChapters = new AsyncObservableCollection<IChapterRecord>();

            _requestQueue = new AsyncRequestQueue();
            _requestQueue.TasksCompleted += _requestQueue_TasksCompleted;
            _requestQueue.Initialize();

            _downloadManager = new DownloadManagerViewModel();

            // load all enabled scrapers
            _scrapers = ScraperLoader.Instance.EnabledScrapers;

            if (!string.IsNullOrEmpty(Properties.Settings.Default.SelectedScraper))
                CurrentScraper = _scrapers.FirstOrDefault(s => s.Name == Properties.Settings.Default.SelectedScraper);

            if (CurrentScraper == null)
                CurrentScraper = _scrapers.First();

            _downloadFormatProviders = ScraperLoader.Instance.DownloadFormatProviders;
            CurrentDownloadFormatProvider = ScraperLoader.Instance.GetFirstOrDefaultDownloadFormatProvider(Properties.Settings.Default.DownloadFormatProvider);

            if (Properties.Settings.Default.EnablePreload)
            {
                PreloadMangas();
            }
        }