Blacker.MangaScraper.Helpers.AsyncRequestQueue.Initialize C# (CSharp) Метод

Initialize() публичный Метод

public Initialize ( ) : void
Результат void
        public void Initialize()
        {
            if(_initialized)
                return;

            try
            {
                _thread.Start();
            }
            catch (Exception ex)
            {
                _log.Error("Unable to start async queue thread.", ex);
                throw;
            }

            _initialized = true;
        }

Usage Example

Пример #1
0
        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();
            }
        }
All Usage Examples Of Blacker.MangaScraper.Helpers.AsyncRequestQueue::Initialize