Integrato lo scraping su thread separato
Integrato menu contestuale per comandare il thread secondario di skraping Aggiornata UI per visualizzare eventi del thread separato Testato scraping 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 - [0/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. - [ ] 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
1fd91b4af2
commit
8233e4edf1
7 files changed
+138
-43
No files matched your search
@@ -1 +1 @@
|
||||
{"RootPath":"C:\\Commesse\\_zPrivate\\A69WD\\Src\\A69WD","ProjectFileName":"A69WD.csproj","Configuration":"Debug|AnyCPU","FrameworkPath":"","Sources":[{"SourceFile":"App.cs"},{"SourceFile":"Data\\cNota.cs"},{"SourceFile":"Data\\cRac.cs"},{"SourceFile":"Data\\DBTools.cs"},{"SourceFile":"Data\\Helper.cs"},{"SourceFile":"Net\\eLinkState.cs"},{"SourceFile":"Net\\cLink_A69.cs"},{"SourceFile":"Service\\Service_Crawler.cs"},{"SourceFile":"Service\\Service_Importer.cs"},{"SourceFile":"Site\\cSite_A69.cs"},{"SourceFile":"UI\\frmDownloader.cs"},{"SourceFile":"UI\\frmDownloader.Designer.cs"},{"SourceFile":"General\\Cfg.cs"},{"SourceFile":"General\\cTools.cs"},{"SourceFile":"General\\Logger.cs"},{"SourceFile":"Net\\iLink.cs"},{"SourceFile":"Properties\\AssemblyInfo.cs"},{"SourceFile":"Site\\iSiteType.cs"},{"SourceFile":"Properties\\Resources.Designer.cs"},{"SourceFile":"Properties\\Settings.Designer.cs"},{"SourceFile":"obj\\Debug\\.NETFramework,Version=v4.8.AssemblyAttributes.cs"}],"References":[{"Reference":"C:\\Commesse\\_zPrivate\\A69WD\\Src\\_Lib\\HtmlAgilityPack.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.8\\Microsoft.CSharp.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.8\\mscorlib.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.8\\System.Core.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.8\\System.Data.DataSetExtensions.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.8\\System.Data.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Commesse\\_zPrivate\\A69WD\\Src\\_Lib\\System.Data.SQLite.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.8\\System.Deployment.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.8\\System.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.8\\System.Drawing.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.8\\System.Net.Http.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.8\\System.Windows.Forms.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.8\\System.Xml.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.8\\System.Xml.Linq.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""}],"Analyzers":[],"Outputs":[{"OutputItemFullPath":"C:\\Commesse\\_zPrivate\\A69WD\\Src\\A69WD\\bin\\Debug\\A69WD.exe","OutputItemRelativePath":"A69WD.exe"},{"OutputItemFullPath":"","OutputItemRelativePath":""}],"CopyToOutputEntries":[]}
|
||||
{"RootPath":"C:\\Commesse\\_zPrivate\\A69WD\\Src\\A69WD","ProjectFileName":"A69WD.csproj","Configuration":"Debug|AnyCPU","FrameworkPath":"","Sources":[{"SourceFile":"App.cs"},{"SourceFile":"Data\\cNota.cs"},{"SourceFile":"Data\\cRac.cs"},{"SourceFile":"Data\\DBTools.cs"},{"SourceFile":"Data\\Helper.cs"},{"SourceFile":"General\\Navigator.cs"},{"SourceFile":"Net\\eLinkState.cs"},{"SourceFile":"Net\\cLink_A69.cs"},{"SourceFile":"Service\\Service_Crawler.cs"},{"SourceFile":"Service\\Service_Importer.cs"},{"SourceFile":"Site\\cSite_A69.cs"},{"SourceFile":"UI\\frmDownloader.cs"},{"SourceFile":"UI\\frmDownloader.Designer.cs"},{"SourceFile":"General\\Cfg.cs"},{"SourceFile":"General\\cTools.cs"},{"SourceFile":"General\\Logger.cs"},{"SourceFile":"Net\\iLink.cs"},{"SourceFile":"Properties\\AssemblyInfo.cs"},{"SourceFile":"Site\\iSiteType.cs"},{"SourceFile":"UI\\frmReader.cs"},{"SourceFile":"UI\\frmReader.Designer.cs"},{"SourceFile":"Properties\\Resources.Designer.cs"},{"SourceFile":"Properties\\Settings.Designer.cs"},{"SourceFile":"obj\\Debug\\.NETFramework,Version=v4.8.AssemblyAttributes.cs"}],"References":[{"Reference":"C:\\Commesse\\_zPrivate\\A69WD\\Src\\_Lib\\HtmlAgilityPack.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.8\\Microsoft.CSharp.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.8\\mscorlib.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.8\\System.Core.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.8\\System.Data.DataSetExtensions.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.8\\System.Data.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Commesse\\_zPrivate\\A69WD\\Src\\_Lib\\System.Data.SQLite.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.8\\System.Deployment.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.8\\System.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.8\\System.Drawing.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.8\\System.Net.Http.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.8\\System.Windows.Forms.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.8\\System.Xml.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.8\\System.Xml.Linq.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""}],"Analyzers":[],"Outputs":[{"OutputItemFullPath":"C:\\Commesse\\_zPrivate\\A69WD\\Src\\A69WD\\bin\\Debug\\A69WD.exe","OutputItemRelativePath":"A69WD.exe"},{"OutputItemFullPath":"","OutputItemRelativePath":""}],"CopyToOutputEntries":[]}
|
||||
@@ -69,12 +69,12 @@
|
||||
<Compile Include="Service\Service_Crawler.cs" />
|
||||
<Compile Include="Service\Service_Importer.cs" />
|
||||
<Compile Include="Site\cSite_A69.cs" />
|
||||
<Compile Include="UI\frmDownloader.cs">
|
||||
<None Include="UI\frmDownloader.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="UI\frmDownloader.Designer.cs">
|
||||
</None>
|
||||
<None Include="UI\frmDownloader.Designer.cs">
|
||||
<DependentUpon>frmDownloader.cs</DependentUpon>
|
||||
</Compile>
|
||||
</None>
|
||||
<Compile Include="General\Cfg.cs" />
|
||||
<Compile Include="General\cTools.cs" />
|
||||
<Compile Include="General\Logger.cs" />
|
||||
@@ -87,9 +87,9 @@
|
||||
<Compile Include="UI\frmReader.Designer.cs">
|
||||
<DependentUpon>frmReader.cs</DependentUpon>
|
||||
</Compile>
|
||||
<EmbeddedResource Include="UI\frmDownloader.resx">
|
||||
<None Include="UI\frmDownloader.resx">
|
||||
<DependentUpon>frmDownloader.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
</None>
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
|
||||
@@ -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.0.0")]
|
||||
[assembly: AssemblyFileVersion("0.4.0.0")]
|
||||
[assembly: AssemblyVersion("0.4.5.0")]
|
||||
[assembly: AssemblyFileVersion("0.4.5.0")]
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@@ -32,26 +32,14 @@ namespace A69WD.Service {
|
||||
// HttpClient autenticato (fornito da AuthService)
|
||||
private iSiteType _site;
|
||||
|
||||
|
||||
public Service_Crawler(Label lblInCorso, ProgressBar pbStatus) {
|
||||
_semaphore = new SemaphoreSlim(Cfg.Settings.nThread);
|
||||
_lblInCorso = lblInCorso;
|
||||
_progressBar = pbStatus;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Riferimenti ai controlli UI per aggiornare i contatori e la progress bar
|
||||
private readonly Label _lblInCorso;
|
||||
//private readonly Label _lblCompletati;
|
||||
//private readonly Label _lblDaFare;
|
||||
//private readonly Label _lblErrori;
|
||||
private readonly ProgressBar _progressBar;
|
||||
private readonly StatusStrip _sb;
|
||||
|
||||
|
||||
public Service_Crawler(StatusStrip sb) {
|
||||
_semaphore = new SemaphoreSlim(Cfg.Settings.nThread);
|
||||
_sb = sb;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -121,30 +109,27 @@ namespace A69WD.Service {
|
||||
/// Aggiorna i contatori e la progress bar sulla UI.
|
||||
/// </summary>
|
||||
private void UpdateCounters() {
|
||||
if (_lblInCorso.InvokeRequired) {
|
||||
_lblInCorso.Invoke(new Action(UpdateCounters));
|
||||
if (_sb.InvokeRequired) {
|
||||
_sb.Invoke(new Action(UpdateCounters));
|
||||
return;
|
||||
}
|
||||
|
||||
int daFare = _urlQueue.Count;
|
||||
|
||||
_lblInCorso.Text = $"In corso: {_inCorso} - Completati: {_completati} - Errori: {_errori} - Da fare: {daFare}";
|
||||
|
||||
int totale = _inCorso + _completati + _errori + daFare;
|
||||
int fatti = _completati + _errori;
|
||||
|
||||
_progressBar.Maximum = totale > 0 ? totale : 1;
|
||||
_progressBar.Value = fatti;
|
||||
|
||||
//_sb.Items["sbStatusLabel"].Text = $"In corso: {_inCorso} - Completati: {_completati} - Errori: {_errori} - Da fare: {daFare}";
|
||||
_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).Value = fatti;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -20,7 +20,7 @@
|
||||
<TextEditor>C:\Program Files\Notepad++\notepad++.exe</TextEditor>
|
||||
|
||||
<!-- Numero di thread secondari. -->
|
||||
<nThread>9</nThread>
|
||||
<nThread>3</nThread>
|
||||
|
||||
|
||||
</Cfg>
|
||||
Generated
+7
-3
@@ -64,8 +64,9 @@
|
||||
| System.Windows.Forms.ToolStripStatusLabelBorderSides.Bottom)));
|
||||
this.sbMessage.BorderStyle = System.Windows.Forms.Border3DStyle.SunkenInner;
|
||||
this.sbMessage.Name = "sbMessage";
|
||||
this.sbMessage.Size = new System.Drawing.Size(472, 19);
|
||||
this.sbMessage.Size = new System.Drawing.Size(452, 19);
|
||||
this.sbMessage.Spring = true;
|
||||
this.sbMessage.Tag = "Messaggi";
|
||||
this.sbMessage.Text = "Messaggi";
|
||||
this.sbMessage.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
this.sbMessage.ToolTipText = "Messaggio";
|
||||
@@ -73,7 +74,8 @@
|
||||
// sbProgressBar
|
||||
//
|
||||
this.sbProgressBar.Name = "sbProgressBar";
|
||||
this.sbProgressBar.Size = new System.Drawing.Size(60, 18);
|
||||
this.sbProgressBar.Size = new System.Drawing.Size(100, 18);
|
||||
this.sbProgressBar.Tag = "ProgressBar";
|
||||
this.sbProgressBar.ToolTipText = "Percentuale di lavoro";
|
||||
//
|
||||
// sbStatusLabel
|
||||
@@ -84,7 +86,8 @@
|
||||
| System.Windows.Forms.ToolStripStatusLabelBorderSides.Bottom)));
|
||||
this.sbStatusLabel.BorderStyle = System.Windows.Forms.Border3DStyle.SunkenInner;
|
||||
this.sbStatusLabel.Name = "sbStatusLabel";
|
||||
this.sbStatusLabel.Size = new System.Drawing.Size(120, 19);
|
||||
this.sbStatusLabel.Size = new System.Drawing.Size(100, 19);
|
||||
this.sbStatusLabel.Tag = "Label";
|
||||
this.sbStatusLabel.ToolTipText = "Stato di eventuali operazioni in background";
|
||||
//
|
||||
// frmReader
|
||||
@@ -98,6 +101,7 @@
|
||||
this.Name = "frmReader";
|
||||
this.Text = "PlugIn_App_Reader.UI Reader (DB vrs1.3, App" +
|
||||
" vrsX.X.X.X)";
|
||||
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.frmReader_FormClosing);
|
||||
this.sb.ResumeLayout(false);
|
||||
this.sb.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
+107
-1
@@ -3,15 +3,27 @@ using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.IO.Ports;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using A69WD.Data;
|
||||
using A69WD.Net;
|
||||
using A69WD.Service;
|
||||
using A69WD.Site;
|
||||
|
||||
namespace A69WD.UI {
|
||||
public partial class frmReader : Form {
|
||||
|
||||
MenuItem mSkrStart;
|
||||
MenuItem mSkrStop;
|
||||
MenuItem mImpStart;
|
||||
MenuItem mImpStop;
|
||||
|
||||
private Service_Crawler serviceCrawler = null;
|
||||
private Service_Importer ServiceImporter = null;
|
||||
A69WD.Site.iSiteType siteA69 = null;
|
||||
|
||||
public frmReader() {
|
||||
InitializeComponent();
|
||||
@@ -27,6 +39,29 @@ namespace A69WD.UI {
|
||||
|
||||
// Aggiorno la status bar
|
||||
sbMessage.Text = string.Format("Racconto {0}", nav.ActualID.ToString("00000"));
|
||||
|
||||
// Menu comandi skraping:
|
||||
MenuItem mSkr = new MenuItem("Skraping");
|
||||
mSkrStart = new MenuItem("Start", MenuItem_Skraping_Start_Click, Shortcut.None);
|
||||
mSkrStop = new MenuItem("Stop", MenuItem_Skraping_Stop_Click, Shortcut.None);
|
||||
mSkr.MenuItems.Add(mSkrStart);
|
||||
mSkr.MenuItems.Add(mSkrStop);
|
||||
// Menu comandi importer:
|
||||
MenuItem mImp = new MenuItem("Importer");
|
||||
mImpStart = new MenuItem("Start", MenuItem_Importer_Start_Click, Shortcut.None);
|
||||
mImpStop = new MenuItem("Stop", MenuItem_Importer_Stop_Click, Shortcut.None);
|
||||
mImp.MenuItems.Add(mImpStart);
|
||||
mImp.MenuItems.Add(mImpStop);
|
||||
// Menu contestuale:
|
||||
this.ContextMenu = new ContextMenu();
|
||||
this.ContextMenu.MenuItems.Add(mSkr);
|
||||
this.ContextMenu.MenuItems.Add(mImp);
|
||||
// Enable only start
|
||||
mSkrStart.Enabled = true;
|
||||
mSkrStop.Enabled = false;
|
||||
mImpStart.Enabled = true;
|
||||
mImpStop.Enabled = false;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -47,7 +82,8 @@ namespace A69WD.UI {
|
||||
|
||||
#region Keys.ESC --> Hide Reader
|
||||
if (e.KeyCode == Keys.Escape) {
|
||||
this.Hide();
|
||||
//this.Hide();
|
||||
this.Close();
|
||||
return;
|
||||
}
|
||||
#endregion
|
||||
@@ -625,6 +661,76 @@ namespace A69WD.UI {
|
||||
}
|
||||
|
||||
|
||||
private void frmReader_FormClosing(object sender, FormClosingEventArgs e) {
|
||||
// Prima di chiudere, devo fermare l'importazione o lo scraping
|
||||
if (serviceCrawler != null) { serviceCrawler.StopWorker(); }
|
||||
if (ServiceImporter != null) { ServiceImporter.StopWorker(); }
|
||||
}
|
||||
|
||||
|
||||
async void MenuItem_Skraping_Start_Click(object sender, EventArgs e) {
|
||||
// Update menu
|
||||
mSkrStart.Enabled = false;
|
||||
mSkrStop.Enabled = true;
|
||||
mImpStart.Enabled = false;
|
||||
mImpStop.Enabled = false;
|
||||
|
||||
// - Creo istanza del client per il sito con autenticazione:
|
||||
sbStatusLabel.Text = "Login on A69";
|
||||
siteA69 = new cSite_A69();
|
||||
|
||||
// - Eseguo l'autenticazione
|
||||
bool res = await siteA69.Authenticate();
|
||||
if (res) {
|
||||
sbStatusLabel.Text = "sito loggato: " + res.ToString();
|
||||
Logger.Information("A69 logged");
|
||||
} else {
|
||||
Logger.Information("Errore di autenticazione al sito A69.");
|
||||
return;
|
||||
}
|
||||
|
||||
// - Verifico path per il download
|
||||
if (!System.IO.Directory.Exists(Cfg.Settings.PathDownloadWorking)) System.IO.Directory.CreateDirectory(Cfg.Settings.PathDownloadWorking);
|
||||
|
||||
// Preparo il servizio
|
||||
serviceCrawler = new Service_Crawler(sb);
|
||||
// Inserisco i link iniziali nella coda
|
||||
if (!cLink_A69.InsertStartLink(serviceCrawler)) {
|
||||
sbStatusLabel.Text = "A69 fault.";
|
||||
return;
|
||||
}
|
||||
// avvio il servizio
|
||||
serviceCrawler.StartWorker(siteA69);
|
||||
}
|
||||
|
||||
void MenuItem_Skraping_Stop_Click(object sender, EventArgs e) {
|
||||
// Update menu
|
||||
mSkrStart.Enabled = false;
|
||||
mSkrStop.Enabled = false;
|
||||
mImpStart.Enabled = true;
|
||||
mImpStop.Enabled = false;
|
||||
|
||||
if (serviceCrawler != null) { serviceCrawler.StopWorker(); }
|
||||
}
|
||||
|
||||
void MenuItem_Importer_Start_Click(object sender, EventArgs e) {
|
||||
// Update menu
|
||||
mSkrStart.Enabled = false;
|
||||
mSkrStop.Enabled = false;
|
||||
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);
|
||||
|
||||
}
|
||||
void MenuItem_Importer_Stop_Click(object sender, EventArgs e) {; }
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user