optimizations
This commit is contained in:
parent
1b78b245d1
commit
b98623f092
5 changed files with 97 additions and 62 deletions
|
|
@ -32,9 +32,12 @@ namespace ImageCatalog
|
|||
private readonly ITestService _service;
|
||||
private readonly ILogger<MainForm> _logger;
|
||||
|
||||
public MainForm(ITestService testService, ILogger<MainForm> logger)
|
||||
private readonly ImageCreationStuff _imageCreationService;
|
||||
|
||||
public MainForm(ITestService testService, ImageCreationStuff imageCreationStuff, ILogger<MainForm> logger)
|
||||
{
|
||||
_service = testService;
|
||||
_imageCreationService = imageCreationStuff;
|
||||
_logger = logger;
|
||||
|
||||
_logger.LogDebug("Start");
|
||||
|
|
@ -254,6 +257,7 @@ namespace ImageCatalog
|
|||
//btnCreaCatalogoAsync.Enabled = true;
|
||||
}
|
||||
|
||||
// Vecchio, non usato
|
||||
private void btnCreaCatalogo_Click(object sender, EventArgs e)
|
||||
{
|
||||
_logger.LogInformation("Avvio elaborazione...");
|
||||
|
|
@ -1573,14 +1577,14 @@ namespace ImageCatalog
|
|||
|
||||
private async void Button1_Click(object sender, EventArgs e)
|
||||
{
|
||||
_logger.LogInformation("Avvio elaborazione...");
|
||||
lockUI();
|
||||
// Dim timeStart As Date
|
||||
// Dim timeStop As Date
|
||||
_mainToken?.Dispose();
|
||||
_mainToken = new CancellationTokenSource();
|
||||
var token = _mainToken.Token;
|
||||
|
||||
|
||||
|
||||
// timeStart = TimeOfDay
|
||||
FixPaths();
|
||||
Label10.Text = "Elaborazione in corso...";
|
||||
|
|
@ -1593,24 +1597,25 @@ namespace ImageCatalog
|
|||
ProgressBar1.Value = 0;
|
||||
|
||||
// Await CreaCatalogoParallel()
|
||||
var imgStf = new ImageCreationStuff();
|
||||
var imageCreationOptions = new ImageCreationStuff.Options();
|
||||
imageCreationOptions.AggiornaSottodirectory = chkAggiornaSottodirectory.Checked;
|
||||
imageCreationOptions.CreaSottocartelle = chkCreaSottocartelle.Checked;
|
||||
imageCreationOptions.FilePerCartella = Conversions.ToInteger(txtFilePerCartella.Text);
|
||||
imageCreationOptions.SuffissoCartelle = txtSuffissoCartelle.Text;
|
||||
imageCreationOptions.CifreContatore = Conversions.ToInteger(txtCifreContatore.Text);
|
||||
imageCreationOptions.NumerazioneType = GetNumerazioneEnum();
|
||||
imageCreationOptions.SourcePath = Model.SourcePath;
|
||||
imageCreationOptions.DestinationPath = Model.DestinationPath;
|
||||
imageCreationOptions.MaxThreads = Conversions.ToInteger(TextBox7.Text);
|
||||
imageCreationOptions.ChunksSize = Conversions.ToInteger(TextBox8.Text);
|
||||
imageCreationOptions.LinearExecution = rdbVecchioMetodo.Checked;
|
||||
|
||||
var imgStf = _imageCreationService; //new ImageCreationStuff();
|
||||
var imageCreationOptions = new ImageCreationStuff.Options
|
||||
{
|
||||
AggiornaSottodirectory = chkAggiornaSottodirectory.Checked,
|
||||
CreaSottocartelle = chkCreaSottocartelle.Checked,
|
||||
FilePerCartella = Conversions.ToInteger(txtFilePerCartella.Text),
|
||||
SuffissoCartelle = txtSuffissoCartelle.Text,
|
||||
CifreContatore = Conversions.ToInteger(txtCifreContatore.Text),
|
||||
NumerazioneType = GetNumerazioneEnum(),
|
||||
SourcePath = Model.SourcePath,
|
||||
DestinationPath = Model.DestinationPath,
|
||||
MaxThreads = Conversions.ToInteger(TextBox7.Text),
|
||||
ChunksSize = Conversions.ToInteger(TextBox8.Text),
|
||||
LinearExecution = rdbVecchioMetodo.Checked
|
||||
};
|
||||
|
||||
try
|
||||
{
|
||||
_results = new ConcurrentBag<string>();
|
||||
_results = [];
|
||||
_currentAmount = 0;
|
||||
_previousAmount = 0;
|
||||
timer1.Tick += Timer1OnTick;
|
||||
|
|
@ -1661,7 +1666,7 @@ namespace ImageCatalog
|
|||
var timeStart = DateAndTime.TimeOfDay;
|
||||
ContaImmaginiThread = 0;
|
||||
setLabel10Text("Elaborazione in corso...");
|
||||
var imgStf = new ImageCreationStuff();
|
||||
var imgStf = _imageCreationService;
|
||||
var imageCreationOptions = new ImageCreationStuff.Options();
|
||||
imageCreationOptions.AggiornaSottodirectory = chkAggiornaSottodirectory.Checked;
|
||||
imageCreationOptions.CreaSottocartelle = chkCreaSottocartelle.Checked;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue