Integrato l'import su thread separato
Integrato menu contestuale per comandare il thread secondario di import Aggiornata UI per visualizzare eventi del thread separato Testato import ToDo: - [X] Inserire un lettore per visualizzare i racconti nel DB - [0/3] Inserire funzionalità avanzate di lettura: - [ ] navigazione avanzata fra i racconti (per id, per autore, per titolo, per tag ecc... - [ ] possibilità di filtrare i racconti - [ ] Notificon per poter nascondere il reader e centralizzare i comandi - [2/3] Integrare lo scraping dei racconti dal web e l'import da file - [X] Integrare lo scraping dei racconti da web, visualizzandolo sulla progress bar e label nella status bar. - [X] Integrare l'import dei racconti da file, visualizzandolo sulla progress bar e label nella status bar. - [ ] Upgradare lo skraping, importando i racconti via via che sono downloadati
This commit is contained in:
1 parent
8233e4edf1
commit
00ad69e4e8
4 files changed
+24
-25
No files matched your search
@@ -32,8 +32,8 @@ using System.Runtime.InteropServices;
|
||||
// È possibile specificare tutti i valori oppure impostare valori predefiniti per i numeri relativi alla revisione e alla build
|
||||
// usando l'asterisco '*' come illustrato di seguito:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("0.4.5.0")]
|
||||
[assembly: AssemblyFileVersion("0.4.5.0")]
|
||||
[assembly: AssemblyVersion("0.4.6.0")]
|
||||
[assembly: AssemblyFileVersion("0.4.6.0")]
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@@ -81,13 +81,13 @@ namespace A69WD.Service {
|
||||
try {
|
||||
List<iLink> urls = await _site.CrawlPageAsync(link);
|
||||
Logger.Information("ProcessQueue: end url " + link.FileName + " - URL trovati: " + urls.Count.ToString("000"));
|
||||
foreach (iLink url in urls) {
|
||||
foreach (iLink url in urls) {
|
||||
if (url.Validate) {
|
||||
// Logger.Warning("URL Validato: " + url.FileName);
|
||||
// Logger.Warning("URL Validato: " + url.FileName);
|
||||
App.DB.LinkLog(url);
|
||||
_urlQueue.Add(url);
|
||||
//} else {
|
||||
// Logger.Warning("URL NON Validato: " + url.FileName);
|
||||
//} else {
|
||||
// Logger.Warning("URL NON Validato: " + url.FileName);
|
||||
}
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
@@ -122,7 +122,7 @@ namespace A69WD.Service {
|
||||
_sb.Items["sbStatusLabel"].Text = $"{totale}|{_inCorso}|{fatti}|{_errori}";
|
||||
_sb.Items["sbStatusLabel"].ToolTipText = "Totali | In Corso | Fatti | Error";
|
||||
|
||||
(_sb.Items["sbProgressBar"] as ToolStripProgressBar).Maximum = totale > 0 ? totale : 1;
|
||||
(_sb.Items["sbProgressBar"] as ToolStripProgressBar).Maximum = totale > 0 ? totale : 1;
|
||||
(_sb.Items["sbProgressBar"] as ToolStripProgressBar).Value = fatti;
|
||||
}
|
||||
|
||||
|
||||
@@ -19,17 +19,15 @@ namespace A69WD.Service {
|
||||
|
||||
// Thread worker che consuma la coda
|
||||
private Thread _workerThread;
|
||||
private readonly Label _lblInCorso;
|
||||
private readonly ProgressBar _progressBar;
|
||||
private readonly StatusStrip _sb;
|
||||
private string _path;
|
||||
// Contatori
|
||||
private int _totali = 0;
|
||||
private int _completati = 0;
|
||||
private int _errori = 0;
|
||||
|
||||
public Service_Importer(Label lblInCorso, ProgressBar pbStatus) {
|
||||
_lblInCorso = lblInCorso;
|
||||
_progressBar = pbStatus;
|
||||
public Service_Importer(StatusStrip sb) {
|
||||
_sb = sb;
|
||||
}
|
||||
|
||||
public void StartWorker(string path) {
|
||||
@@ -104,17 +102,18 @@ namespace A69WD.Service {
|
||||
|
||||
|
||||
private void UpdateCounters() {
|
||||
if (_lblInCorso.InvokeRequired) {
|
||||
_lblInCorso.Invoke(new Action(UpdateCounters));
|
||||
if (_sb.InvokeRequired) {
|
||||
_sb.Invoke(new Action(UpdateCounters));
|
||||
return;
|
||||
}
|
||||
|
||||
int daFare = _totali - _completati - _errori;
|
||||
|
||||
_lblInCorso.Text = $"Totali: {_totali} - Completati: {_completati} - Errori: {_errori} - Da fare: {daFare}";
|
||||
_sb.Items["sbStatusLabel"].Text = $"{_totali}|{_completati}|{_errori}";
|
||||
_sb.Items["sbStatusLabel"].ToolTipText = "Totali | Completati | Error";
|
||||
|
||||
_progressBar.Maximum = _totali > 0 ? _totali : 1;
|
||||
_progressBar.Value = _completati + _errori;
|
||||
(_sb.Items["sbProgressBar"] as ToolStripProgressBar).Maximum = _totali > 0 ? _totali : 1;
|
||||
(_sb.Items["sbProgressBar"] as ToolStripProgressBar).Value = _completati + _errori;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -720,14 +720,14 @@ namespace A69WD.UI {
|
||||
mImpStart.Enabled = false;
|
||||
mImpStop.Enabled = true;
|
||||
|
||||
//// Preparo il servizio
|
||||
//ServiceImporter = new Service_Importer(sb);
|
||||
//
|
||||
//// Per ora uso la directory di default, poi metteremo selezione
|
||||
//string path = Cfg.Settings.PathDownloadWorking;
|
||||
//
|
||||
//// avvio il servizio
|
||||
//ServiceImporter.StartWorker(path);
|
||||
// Preparo il servizio
|
||||
ServiceImporter = new Service_Importer(sb);
|
||||
|
||||
// Per ora uso la directory di default, poi metteremo selezione
|
||||
string path = Cfg.Settings.PathDownloadWorking;
|
||||
|
||||
// avvio il servizio
|
||||
ServiceImporter.StartWorker(path);
|
||||
|
||||
}
|
||||
void MenuItem_Importer_Stop_Click(object sender, EventArgs e) {; }
|
||||
|
||||
Reference in new issue
Block a user