Chunks and threads in model
This commit is contained in:
parent
a466efbb27
commit
764a439645
4 changed files with 155 additions and 321 deletions
|
|
@ -134,6 +134,30 @@ namespace ImageCatalog_2
|
|||
}
|
||||
}
|
||||
|
||||
private int _chunkSize;
|
||||
|
||||
public int ChunkSize
|
||||
{
|
||||
get => _chunkSize;
|
||||
set
|
||||
{
|
||||
_chunkSize = value;
|
||||
NotifyPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
private int _threadsCount;
|
||||
|
||||
public int ThreadsCount
|
||||
{
|
||||
get => _threadsCount;
|
||||
set
|
||||
{
|
||||
_threadsCount = value;
|
||||
NotifyPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
private void Test(object parameter)
|
||||
{
|
||||
Debug.WriteLine("Yep");
|
||||
|
|
|
|||
58
imagecatalog/MainForm.Designer.cs
generated
58
imagecatalog/MainForm.Designer.cs
generated
|
|
@ -48,13 +48,13 @@ namespace ImageCatalog
|
|||
button1 = new Button();
|
||||
btnTest = new Button();
|
||||
GroupBox11 = new GroupBox();
|
||||
numericUpDown2 = new NumericUpDown();
|
||||
numericUpDown1 = new NumericUpDown();
|
||||
Panel3 = new Panel();
|
||||
rdbNuovoMetodo = new RadioButton();
|
||||
rdbVecchioMetodo = new RadioButton();
|
||||
Label8 = new Label();
|
||||
TextBox8 = new TextBox();
|
||||
Label7 = new Label();
|
||||
TextBox7 = new TextBox();
|
||||
GroupBox3 = new GroupBox();
|
||||
chkAggiornaSottodirectory = new CheckBox();
|
||||
_Button3 = new Button();
|
||||
|
|
@ -186,6 +186,8 @@ namespace ImageCatalog
|
|||
TabControl1.SuspendLayout();
|
||||
TabPage5.SuspendLayout();
|
||||
GroupBox11.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDown2).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDown1).BeginInit();
|
||||
Panel3.SuspendLayout();
|
||||
GroupBox3.SuspendLayout();
|
||||
GroupBox8.SuspendLayout();
|
||||
|
|
@ -304,11 +306,11 @@ namespace ImageCatalog
|
|||
//
|
||||
// GroupBox11
|
||||
//
|
||||
GroupBox11.Controls.Add(numericUpDown2);
|
||||
GroupBox11.Controls.Add(numericUpDown1);
|
||||
GroupBox11.Controls.Add(Panel3);
|
||||
GroupBox11.Controls.Add(Label8);
|
||||
GroupBox11.Controls.Add(TextBox8);
|
||||
GroupBox11.Controls.Add(Label7);
|
||||
GroupBox11.Controls.Add(TextBox7);
|
||||
GroupBox11.Location = new Point(15, 515);
|
||||
GroupBox11.Margin = new Padding(6, 8, 6, 8);
|
||||
GroupBox11.Name = "GroupBox11";
|
||||
|
|
@ -318,6 +320,24 @@ namespace ImageCatalog
|
|||
GroupBox11.TabStop = false;
|
||||
GroupBox11.Text = "Avanzate (ATTENZIONE)";
|
||||
//
|
||||
// numericUpDown2
|
||||
//
|
||||
numericUpDown2.DataBindings.Add(new Binding("Value", bindingSource1, "ThreadsCount", true, DataSourceUpdateMode.OnPropertyChanged));
|
||||
numericUpDown2.Location = new Point(15, 118);
|
||||
numericUpDown2.Maximum = new decimal(new int[] { 10000, 0, 0, 0 });
|
||||
numericUpDown2.Name = "numericUpDown2";
|
||||
numericUpDown2.Size = new Size(114, 39);
|
||||
numericUpDown2.TabIndex = 52;
|
||||
//
|
||||
// numericUpDown1
|
||||
//
|
||||
numericUpDown1.DataBindings.Add(new Binding("Value", bindingSource1, "ChunkSize", true, DataSourceUpdateMode.OnPropertyChanged));
|
||||
numericUpDown1.Location = new Point(15, 62);
|
||||
numericUpDown1.Maximum = new decimal(new int[] { 10000, 0, 0, 0 });
|
||||
numericUpDown1.Name = "numericUpDown1";
|
||||
numericUpDown1.Size = new Size(114, 39);
|
||||
numericUpDown1.TabIndex = 51;
|
||||
//
|
||||
// Panel3
|
||||
//
|
||||
Panel3.Controls.Add(rdbNuovoMetodo);
|
||||
|
|
@ -362,33 +382,15 @@ namespace ImageCatalog
|
|||
Label8.TabIndex = 3;
|
||||
Label8.Text = "Chunk Size (0 = MAX)";
|
||||
//
|
||||
// TextBox8
|
||||
//
|
||||
TextBox8.Location = new Point(15, 50);
|
||||
TextBox8.Margin = new Padding(6, 8, 6, 8);
|
||||
TextBox8.Name = "TextBox8";
|
||||
TextBox8.Size = new Size(97, 39);
|
||||
TextBox8.TabIndex = 2;
|
||||
TextBox8.Text = "0";
|
||||
//
|
||||
// Label7
|
||||
//
|
||||
Label7.AutoSize = true;
|
||||
Label7.Location = new Point(132, 118);
|
||||
Label7.Location = new Point(138, 120);
|
||||
Label7.Margin = new Padding(6, 0, 6, 0);
|
||||
Label7.Name = "Label7";
|
||||
Label7.Size = new Size(236, 32);
|
||||
Label7.Size = new Size(213, 32);
|
||||
Label7.TabIndex = 1;
|
||||
Label7.Text = "Threads (0 = CPU *2)";
|
||||
//
|
||||
// TextBox7
|
||||
//
|
||||
TextBox7.Location = new Point(15, 114);
|
||||
TextBox7.Margin = new Padding(6, 8, 6, 8);
|
||||
TextBox7.Name = "TextBox7";
|
||||
TextBox7.Size = new Size(97, 39);
|
||||
TextBox7.TabIndex = 0;
|
||||
TextBox7.Text = "0";
|
||||
Label7.Text = "Threads (0 = Auto)";
|
||||
//
|
||||
// GroupBox3
|
||||
//
|
||||
|
|
@ -1832,6 +1834,8 @@ namespace ImageCatalog
|
|||
TabPage5.ResumeLayout(false);
|
||||
GroupBox11.ResumeLayout(false);
|
||||
GroupBox11.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDown2).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDown1).EndInit();
|
||||
Panel3.ResumeLayout(false);
|
||||
Panel3.PerformLayout();
|
||||
GroupBox3.ResumeLayout(false);
|
||||
|
|
@ -2302,9 +2306,7 @@ namespace ImageCatalog
|
|||
|
||||
internal GroupBox GroupBox11;
|
||||
internal Label Label7;
|
||||
internal TextBox TextBox7;
|
||||
internal Label Label8;
|
||||
internal TextBox TextBox8;
|
||||
internal Panel Panel3;
|
||||
internal RadioButton rdbNuovoMetodo;
|
||||
internal RadioButton rdbVecchioMetodo;
|
||||
|
|
@ -2316,6 +2318,8 @@ namespace ImageCatalog
|
|||
private BindingSource bindingSource1;
|
||||
private Button btnTest;
|
||||
private Button button1;
|
||||
private NumericUpDown numericUpDown1;
|
||||
private NumericUpDown numericUpDown2;
|
||||
|
||||
internal Button btnCreaCatalogoAsync
|
||||
{
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ public partial class MainForm
|
|||
var version = Assembly.GetExecutingAssembly().GetName().Version;
|
||||
_Label27.Text = $"Version: {version.Major}.{version.Minor}.{version.Build}.{version.Revision}";
|
||||
|
||||
_results = new ConcurrentBag<string>();
|
||||
_results = [];
|
||||
UiUpdateEvent += OnUiUpdateEvent;
|
||||
}
|
||||
|
||||
|
|
@ -90,7 +90,7 @@ public partial class MainForm
|
|||
}
|
||||
}
|
||||
|
||||
delegate void SetProgressCallback(ProgressBar target, int amount, int maximum);
|
||||
private delegate void SetProgressCallback(ProgressBar target, int amount, int maximum);
|
||||
|
||||
private void SetProgress(ProgressBar target, int amount, int maximum)
|
||||
{
|
||||
|
|
@ -114,14 +114,7 @@ public partial class MainForm
|
|||
SetText(lblFotoTotaliNum, args.Item2.ToString());
|
||||
}
|
||||
|
||||
private bool WaterSelectColor = false;
|
||||
|
||||
// Private ContaFotoCuori As Integer
|
||||
// Private TaskCuori() As PicInfo
|
||||
|
||||
private int ContaImmaginiThread;
|
||||
private int maxThreads = 15;
|
||||
private int minThreads = 5;
|
||||
private bool _waterSelectColor = false;
|
||||
|
||||
private ConcurrentBag<string> _results;
|
||||
|
||||
|
|
@ -150,8 +143,8 @@ public partial class MainForm
|
|||
txtCifreContatore.Text = "2";
|
||||
TextBox25.Text = "50";
|
||||
TextBox26.Text = "";
|
||||
TextBox7.Text = 4.ToString();
|
||||
TextBox8.Text = 4.ToString();
|
||||
Model.ThreadsCount = 10;
|
||||
Model.ChunkSize = 100;
|
||||
TextBox34.Text = "Yellow";
|
||||
TextBox30.Text = "20";
|
||||
TextBox31.Text = "6";
|
||||
|
|
@ -378,8 +371,8 @@ public partial class MainForm
|
|||
_parametriSetup.AggiornaParametro("CompressioneJpeg", TextBox32.Text);
|
||||
_parametriSetup.AggiornaParametro("CompressioneJpegMiniatura", TextBox33.Text);
|
||||
// 2021
|
||||
_parametriSetup.AggiornaParametro("ChunkSize", TextBox8.Text);
|
||||
_parametriSetup.AggiornaParametro("ThreadsCount", TextBox7.Text);
|
||||
_parametriSetup.AggiornaParametro("ChunkSize", Model.ChunkSize.ToString());
|
||||
_parametriSetup.AggiornaParametro("ThreadsCount", Model.ThreadsCount.ToString());
|
||||
_parametriSetup.AggiornaParametro("OverwriteImages", Model.OverwriteImages);
|
||||
_parametriSetup.SalvaParametriSetup();
|
||||
Text = "Image Catalog - " + LeggiSoloNomeFile(ilNome);
|
||||
|
|
@ -393,102 +386,102 @@ public partial class MainForm
|
|||
openFileDialog.Filter = "Setup (*.xml)|*.xml|All valid files (*.*)|*.*";
|
||||
openFileDialog.FilterIndex = 0;
|
||||
openFileDialog.RestoreDirectory = true;
|
||||
if (DialogResult.OK == openFileDialog.ShowDialog())
|
||||
|
||||
if (DialogResult.OK != openFileDialog.ShowDialog()) return;
|
||||
|
||||
var ilNome = openFileDialog.FileName;
|
||||
_parametriSetup.NomeFileSetup = ilNome;
|
||||
_parametriSetup.CaricaParametriSetup();
|
||||
Model.SourcePath = _parametriSetup.LeggiParametroString("DirSorgente");
|
||||
Model.DestinationPath = _parametriSetup.LeggiParametroString("DirDestinazione");
|
||||
chkAggiornaSottodirectory.Checked = _parametriSetup.LeggiParametroBoolean("DirSottoDirectory");
|
||||
chkCreaSottocartelle.Checked = _parametriSetup.LeggiParametroBoolean("DirDividiDestinazione");
|
||||
txtFilePerCartella.Text = _parametriSetup.LeggiParametroString("DirDividiNumFile");
|
||||
txtSuffissoCartelle.Text = _parametriSetup.LeggiParametroString("DirDividiSuffisso");
|
||||
txtCifreContatore.Text = _parametriSetup.LeggiParametroString("DirDividiNumCifre");
|
||||
string TestoTemp = _parametriSetup.LeggiParametroString("DirDividiTipoNumerazione");
|
||||
if (TestoTemp.ToUpper() == "PROGRESSIVA")
|
||||
{
|
||||
string IlNome = openFileDialog.FileName;
|
||||
_parametriSetup.NomeFileSetup = IlNome;
|
||||
_parametriSetup.CaricaParametriSetup();
|
||||
Model.SourcePath = _parametriSetup.LeggiParametroString("DirSorgente");
|
||||
Model.DestinationPath = _parametriSetup.LeggiParametroString("DirDestinazione");
|
||||
chkAggiornaSottodirectory.Checked = _parametriSetup.LeggiParametroBoolean("DirSottoDirectory");
|
||||
chkCreaSottocartelle.Checked = _parametriSetup.LeggiParametroBoolean("DirDividiDestinazione");
|
||||
txtFilePerCartella.Text = _parametriSetup.LeggiParametroString("DirDividiNumFile");
|
||||
txtSuffissoCartelle.Text = _parametriSetup.LeggiParametroString("DirDividiSuffisso");
|
||||
txtCifreContatore.Text = _parametriSetup.LeggiParametroString("DirDividiNumCifre");
|
||||
string TestoTemp = _parametriSetup.LeggiParametroString("DirDividiTipoNumerazione");
|
||||
if (TestoTemp.ToUpper() == "PROGRESSIVA")
|
||||
rdbNumProgressiva.Checked = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
rdbNumFiles.Checked = true;
|
||||
}
|
||||
|
||||
CheckBox1.Checked = _parametriSetup.LeggiParametroBoolean("MiniatureCrea");
|
||||
TextBox3.Text = _parametriSetup.LeggiParametroString("MiniatureSuffisso");
|
||||
TextBox5.Text = _parametriSetup.LeggiParametroString("MiniatureAltezza");
|
||||
TextBox6.Text = _parametriSetup.LeggiParametroString("MiniatureLarghezza");
|
||||
RadioButton3.Checked = _parametriSetup.LeggiParametroBoolean("MiniatureAddScritta");
|
||||
RadioButton4.Checked = _parametriSetup.LeggiParametroBoolean("MiniatureAddOrario");
|
||||
TextBox27.Text = _parametriSetup.LeggiParametroString("FotoAltezza");
|
||||
TextBox28.Text = _parametriSetup.LeggiParametroString("FotoLarghezza");
|
||||
// TextBox13.Text = SetupIni.LeggiParametroString("FotoCodice")
|
||||
// CheckBox2.Checked = SetupIni.LeggiParametroBoolean("FotoDimOriginali")
|
||||
|
||||
TextBox11.Text = _parametriSetup.LeggiParametroString("FontDimensione");
|
||||
TextBox25.Text = _parametriSetup.LeggiParametroString("FontDimensioneMiniatura");
|
||||
CheckBox3.Checked = _parametriSetup.LeggiParametroBoolean("FontBold");
|
||||
ComboBox3.Text = _parametriSetup.LeggiParametroString("FontNome");
|
||||
if (string.IsNullOrEmpty(TextBox25.Text))
|
||||
{
|
||||
TextBox25.Text = "0";
|
||||
}
|
||||
|
||||
Model.HorizontalText = _parametriSetup.LeggiParametroString("TestoTesto");
|
||||
TextBox9.Text = _parametriSetup.LeggiParametroString("TestoTrasparente");
|
||||
TextBox12.Text = _parametriSetup.LeggiParametroString("TestoMargine");
|
||||
ComboBox1.Text = _parametriSetup.LeggiParametroString("TestoPosizione");
|
||||
ComboBox2.Text = _parametriSetup.LeggiParametroString("TestoAllineamento");
|
||||
TextBox10.Text = _parametriSetup.LeggiParametroString("MarchioFile");
|
||||
TextBox14.Text = _parametriSetup.LeggiParametroString("MarchioAltezza");
|
||||
TextBox15.Text = _parametriSetup.LeggiParametroString("MarchioLarghezza");
|
||||
TextBox16.Text = _parametriSetup.LeggiParametroString("MarchioMargine");
|
||||
ComboBox4.Text = _parametriSetup.LeggiParametroString("MarchioAllOrizzontale");
|
||||
ComboBox5.Text = _parametriSetup.LeggiParametroString("MarchioAllVerticale");
|
||||
TextBox19.Text = _parametriSetup.LeggiParametroString("MarchioTrasparenza");
|
||||
CheckBox5.Checked = _parametriSetup.LeggiParametroBoolean("MarchioAggiungi");
|
||||
CheckBox7.Checked = _parametriSetup.LeggiParametroBoolean("TempoGara");
|
||||
CheckBox8.Checked = _parametriSetup.LeggiParametroBoolean("Orario");
|
||||
TextBox18.Text = _parametriSetup.LeggiParametroString("EtichettaOrario");
|
||||
chkForzaJpg.Checked = _parametriSetup.LeggiParametroBoolean("GeneraleForzaJpg");
|
||||
chkRotazioneAutomatica.Checked = _parametriSetup.LeggiParametroBoolean("GeneraleRotazioneAutomatica");
|
||||
TextBox30.Text = _parametriSetup.LeggiParametroString("GrandezzaVerticale");
|
||||
TextBox31.Text = _parametriSetup.LeggiParametroString("MargineVerticale");
|
||||
CheckBox15.Checked = _parametriSetup.LeggiParametroBoolean("DimensioniOriginali");
|
||||
Model.VerticalText = _parametriSetup.LeggiParametroString("TestoVerticale");
|
||||
RadioButton6.Checked = _parametriSetup.LeggiParametroBoolean("NomeMiniatura");
|
||||
CheckBox16.Checked = _parametriSetup.LeggiParametroBoolean("DataFoto");
|
||||
CheckBox17.Checked = _parametriSetup.LeggiParametroBoolean("NumeroFoto");
|
||||
RadioButton5.Checked = _parametriSetup.LeggiParametroBoolean("TempoSmall");
|
||||
RadioButton7.Checked = _parametriSetup.LeggiParametroBoolean("NumTempoSmall");
|
||||
TextBox32.Text = _parametriSetup.LeggiParametroString("CompressioneJpeg");
|
||||
TextBox33.Text = _parametriSetup.LeggiParametroString("CompressioneJpegMiniatura");
|
||||
TextBox34.Text = _parametriSetup.LeggiParametroString("ColoreTestoRGB");
|
||||
Model.OverwriteImages = _parametriSetup.LeggiParametroBoolean("OverwriteImages");
|
||||
if (File.Exists(TextBox10.Text))
|
||||
{
|
||||
PictureBox1.Image = Image.FromFile(TextBox10.Text);
|
||||
if (PictureBox1.Image.Height >= PictureBox1.Image.Width)
|
||||
{
|
||||
rdbNumProgressiva.Checked = true;
|
||||
PictureBox1.Height = 160;
|
||||
PictureBox1.Width =
|
||||
(int)(160 * PictureBox1.Image.Width / (double)PictureBox1.Image.Height);
|
||||
}
|
||||
else
|
||||
{
|
||||
rdbNumFiles.Checked = true;
|
||||
PictureBox1.Width = 224;
|
||||
PictureBox1.Height =
|
||||
(int)(224 * PictureBox1.Image.Height / (double)PictureBox1.Image.Width);
|
||||
}
|
||||
|
||||
CheckBox1.Checked = _parametriSetup.LeggiParametroBoolean("MiniatureCrea");
|
||||
TextBox3.Text = _parametriSetup.LeggiParametroString("MiniatureSuffisso");
|
||||
TextBox5.Text = _parametriSetup.LeggiParametroString("MiniatureAltezza");
|
||||
TextBox6.Text = _parametriSetup.LeggiParametroString("MiniatureLarghezza");
|
||||
RadioButton3.Checked = _parametriSetup.LeggiParametroBoolean("MiniatureAddScritta");
|
||||
RadioButton4.Checked = _parametriSetup.LeggiParametroBoolean("MiniatureAddOrario");
|
||||
TextBox27.Text = _parametriSetup.LeggiParametroString("FotoAltezza");
|
||||
TextBox28.Text = _parametriSetup.LeggiParametroString("FotoLarghezza");
|
||||
// TextBox13.Text = SetupIni.LeggiParametroString("FotoCodice")
|
||||
// CheckBox2.Checked = SetupIni.LeggiParametroBoolean("FotoDimOriginali")
|
||||
|
||||
TextBox11.Text = _parametriSetup.LeggiParametroString("FontDimensione");
|
||||
TextBox25.Text = _parametriSetup.LeggiParametroString("FontDimensioneMiniatura");
|
||||
CheckBox3.Checked = _parametriSetup.LeggiParametroBoolean("FontBold");
|
||||
ComboBox3.Text = _parametriSetup.LeggiParametroString("FontNome");
|
||||
if (string.IsNullOrEmpty(TextBox25.Text))
|
||||
{
|
||||
TextBox25.Text = "0";
|
||||
}
|
||||
|
||||
Model.HorizontalText = _parametriSetup.LeggiParametroString("TestoTesto");
|
||||
TextBox9.Text = _parametriSetup.LeggiParametroString("TestoTrasparente");
|
||||
TextBox12.Text = _parametriSetup.LeggiParametroString("TestoMargine");
|
||||
ComboBox1.Text = _parametriSetup.LeggiParametroString("TestoPosizione");
|
||||
ComboBox2.Text = _parametriSetup.LeggiParametroString("TestoAllineamento");
|
||||
TextBox10.Text = _parametriSetup.LeggiParametroString("MarchioFile");
|
||||
TextBox14.Text = _parametriSetup.LeggiParametroString("MarchioAltezza");
|
||||
TextBox15.Text = _parametriSetup.LeggiParametroString("MarchioLarghezza");
|
||||
TextBox16.Text = _parametriSetup.LeggiParametroString("MarchioMargine");
|
||||
ComboBox4.Text = _parametriSetup.LeggiParametroString("MarchioAllOrizzontale");
|
||||
ComboBox5.Text = _parametriSetup.LeggiParametroString("MarchioAllVerticale");
|
||||
TextBox19.Text = _parametriSetup.LeggiParametroString("MarchioTrasparenza");
|
||||
CheckBox5.Checked = _parametriSetup.LeggiParametroBoolean("MarchioAggiungi");
|
||||
CheckBox7.Checked = _parametriSetup.LeggiParametroBoolean("TempoGara");
|
||||
CheckBox8.Checked = _parametriSetup.LeggiParametroBoolean("Orario");
|
||||
TextBox18.Text = _parametriSetup.LeggiParametroString("EtichettaOrario");
|
||||
chkForzaJpg.Checked = _parametriSetup.LeggiParametroBoolean("GeneraleForzaJpg");
|
||||
chkRotazioneAutomatica.Checked = _parametriSetup.LeggiParametroBoolean("GeneraleRotazioneAutomatica");
|
||||
TextBox30.Text = _parametriSetup.LeggiParametroString("GrandezzaVerticale");
|
||||
TextBox31.Text = _parametriSetup.LeggiParametroString("MargineVerticale");
|
||||
CheckBox15.Checked = _parametriSetup.LeggiParametroBoolean("DimensioniOriginali");
|
||||
Model.VerticalText = _parametriSetup.LeggiParametroString("TestoVerticale");
|
||||
RadioButton6.Checked = _parametriSetup.LeggiParametroBoolean("NomeMiniatura");
|
||||
CheckBox16.Checked = _parametriSetup.LeggiParametroBoolean("DataFoto");
|
||||
CheckBox17.Checked = _parametriSetup.LeggiParametroBoolean("NumeroFoto");
|
||||
RadioButton5.Checked = _parametriSetup.LeggiParametroBoolean("TempoSmall");
|
||||
RadioButton7.Checked = _parametriSetup.LeggiParametroBoolean("NumTempoSmall");
|
||||
TextBox32.Text = _parametriSetup.LeggiParametroString("CompressioneJpeg");
|
||||
TextBox33.Text = _parametriSetup.LeggiParametroString("CompressioneJpegMiniatura");
|
||||
TextBox34.Text = _parametriSetup.LeggiParametroString("ColoreTestoRGB");
|
||||
Model.OverwriteImages = _parametriSetup.LeggiParametroBoolean("OverwriteImages");
|
||||
if (File.Exists(TextBox10.Text))
|
||||
{
|
||||
PictureBox1.Image = Image.FromFile(TextBox10.Text);
|
||||
if (PictureBox1.Image.Height >= PictureBox1.Image.Width)
|
||||
{
|
||||
PictureBox1.Height = 160;
|
||||
PictureBox1.Width =
|
||||
(int)(160 * PictureBox1.Image.Width / (double)PictureBox1.Image.Height);
|
||||
}
|
||||
else
|
||||
{
|
||||
PictureBox1.Width = 224;
|
||||
PictureBox1.Height =
|
||||
(int)(224 * PictureBox1.Image.Height / (double)PictureBox1.Image.Width);
|
||||
}
|
||||
}
|
||||
|
||||
Text = "Image Catalog - " + LeggiSoloNomeFile(IlNome);
|
||||
|
||||
// 2021
|
||||
TextBox8.Text = _parametriSetup.LeggiParametroString("ChunkSize");
|
||||
TextBox7.Text = _parametriSetup.LeggiParametroString("ThreadsCount");
|
||||
}
|
||||
|
||||
Text = "Image Catalog - " + LeggiSoloNomeFile(ilNome);
|
||||
|
||||
// 2021
|
||||
Model.ChunkSize = int.Parse(_parametriSetup.LeggiParametroString("ChunkSize"));
|
||||
Model.ThreadsCount = int.Parse(_parametriSetup.LeggiParametroString("ThreadsCount"));
|
||||
}
|
||||
|
||||
private void SetPicSettings(string SourcePath, string DestPath)
|
||||
|
|
@ -570,76 +563,6 @@ public partial class MainForm
|
|||
_picSettings.OverwriteFiles = Model.OverwriteImages;
|
||||
}
|
||||
|
||||
private List<FileInfo> getFiles(DirectoryInfo sourceDir)
|
||||
{
|
||||
var picList = new List<FileInfo>();
|
||||
foreach (var childFile in sourceDir.GetFiles("*.jpg"))
|
||||
picList.Add(childFile);
|
||||
return picList;
|
||||
}
|
||||
|
||||
private void setLabel17Text(string text)
|
||||
{
|
||||
if (lblFotoTotaliNum.InvokeRequired)
|
||||
{
|
||||
lblFotoTotaliNum.Invoke(new Action<string>(setLabel17Text), text);
|
||||
}
|
||||
else
|
||||
{
|
||||
lblFotoTotaliNum.Text = text;
|
||||
}
|
||||
}
|
||||
|
||||
private void setLabel10Text(string text)
|
||||
{
|
||||
if (Label10.InvokeRequired)
|
||||
{
|
||||
Label10.Invoke(new Action<string>(setLabel10Text), text);
|
||||
}
|
||||
else
|
||||
{
|
||||
Label10.Text = text;
|
||||
}
|
||||
}
|
||||
|
||||
public void stepProgressBar()
|
||||
{
|
||||
if (ProgressBar1.InvokeRequired)
|
||||
{
|
||||
ProgressBar1.Invoke(new System.Windows.Forms.MethodInvoker(ProgressBar1.PerformStep));
|
||||
}
|
||||
else
|
||||
{
|
||||
ProgressBar1.PerformStep();
|
||||
}
|
||||
|
||||
setLabel18Text(ProgressBar1.Value.ToString());
|
||||
}
|
||||
|
||||
private void setProgressBarMaximum(int value)
|
||||
{
|
||||
if (ProgressBar1.InvokeRequired)
|
||||
{
|
||||
ProgressBar1.Invoke(new Action<int>(setProgressBarMaximum), (object)value);
|
||||
}
|
||||
else
|
||||
{
|
||||
ProgressBar1.Maximum = value;
|
||||
}
|
||||
}
|
||||
|
||||
private void setProgressBarValue(int value)
|
||||
{
|
||||
if (ProgressBar1.InvokeRequired)
|
||||
{
|
||||
ProgressBar1.Invoke(new Action<int>(setProgressBarValue), (object)value);
|
||||
}
|
||||
else
|
||||
{
|
||||
ProgressBar1.Value = value;
|
||||
}
|
||||
}
|
||||
|
||||
private void setLabel18Text(string text)
|
||||
{
|
||||
if (Label18.InvokeRequired)
|
||||
|
|
@ -652,33 +575,6 @@ public partial class MainForm
|
|||
}
|
||||
}
|
||||
|
||||
private void setLabel43Text(string text)
|
||||
{
|
||||
if (Label43.InvokeRequired)
|
||||
{
|
||||
Label43.Invoke(new Action<string>(setLabel43Text), text);
|
||||
}
|
||||
else
|
||||
{
|
||||
Label43.Text = text;
|
||||
}
|
||||
}
|
||||
|
||||
private int getNumerazione()
|
||||
{
|
||||
int numerazione;
|
||||
if (rdbNumProgressiva.Checked)
|
||||
{
|
||||
numerazione = (int)FileHelper.numerazione.Progressiva;
|
||||
}
|
||||
else
|
||||
{
|
||||
numerazione = (int)FileHelper.numerazione.Files;
|
||||
}
|
||||
|
||||
return numerazione;
|
||||
}
|
||||
|
||||
private NumerazioneType GetNumerazioneEnum()
|
||||
{
|
||||
NumerazioneType numerazioneType;
|
||||
|
|
@ -694,83 +590,6 @@ public partial class MainForm
|
|||
return numerazioneType;
|
||||
}
|
||||
|
||||
|
||||
private void CopyDirectoryFile(string SourcePath, string DestPath, bool OverWrite = false)
|
||||
{
|
||||
var SourceDir = new DirectoryInfo(SourcePath);
|
||||
var DestDir = new DirectoryInfo(DestPath);
|
||||
if (SourceDir.Exists)
|
||||
{
|
||||
if (!DestDir.Exists)
|
||||
{
|
||||
DestDir.Create();
|
||||
// copy all the files of the current directory
|
||||
}
|
||||
|
||||
foreach (var childFile in SourceDir.GetFiles())
|
||||
{
|
||||
if (OverWrite)
|
||||
{
|
||||
childFile.CopyTo(Path.Combine(DestDir.FullName, childFile.Name), true);
|
||||
}
|
||||
// if overwrite = false, copy the file only if it does not exist
|
||||
// this is done to avoid an IOException if a file already exists
|
||||
// this way the other files can be copied anyway...
|
||||
else if (!File.Exists(Path.Combine(DestDir.FullName, childFile.Name)))
|
||||
{
|
||||
childFile.CopyTo(Path.Combine(DestDir.FullName, childFile.Name), false);
|
||||
}
|
||||
// copy all the sub-directories by recursively calling this same routine
|
||||
}
|
||||
|
||||
foreach (var subDir in SourceDir.GetDirectories())
|
||||
CopyDirectoryFile(subDir.FullName, Path.Combine(DestDir.FullName, subDir.Name), OverWrite);
|
||||
}
|
||||
}
|
||||
|
||||
public Size NewthumbSize(int currentwidth, int currentheight, int MaxPixel, string TipoSize)
|
||||
{
|
||||
// Calculate the Size of the New image
|
||||
// *** Larghezza, Altezza, Auto
|
||||
|
||||
double tempMultiplier;
|
||||
if ((TipoSize.ToUpper() ?? "") == ("Larghezza".ToUpper() ?? ""))
|
||||
{
|
||||
tempMultiplier = MaxPixel / (double)currentwidth;
|
||||
}
|
||||
else if ((TipoSize.ToUpper() ?? "") == ("Altezza".ToUpper() ?? ""))
|
||||
{
|
||||
tempMultiplier = MaxPixel / (double)currentheight;
|
||||
}
|
||||
else if (currentheight > currentwidth) // portrait
|
||||
{
|
||||
tempMultiplier = MaxPixel / (double)currentheight;
|
||||
}
|
||||
else
|
||||
{
|
||||
tempMultiplier = MaxPixel / (double)currentwidth;
|
||||
}
|
||||
|
||||
var NewSize = new Size((int)Math.Round(currentwidth * tempMultiplier),
|
||||
(int)Math.Round(currentheight * tempMultiplier));
|
||||
return NewSize;
|
||||
}
|
||||
|
||||
// private void Button7_Click(object sender, EventArgs e)
|
||||
// {
|
||||
// try
|
||||
// {
|
||||
// Model.MainToken?.Cancel();
|
||||
// }
|
||||
// catch (Exception exception)
|
||||
// {
|
||||
// _logger.LogError(exception.Message);
|
||||
// _logger.LogInformation("Ignora questo errore");
|
||||
// }
|
||||
//
|
||||
// unlockUI();
|
||||
// }
|
||||
|
||||
private void Button4_Click(object sender, EventArgs e)
|
||||
{
|
||||
var openFileDialog = new OpenFileDialog();
|
||||
|
|
@ -826,11 +645,11 @@ public partial class MainForm
|
|||
{
|
||||
if (e.Button == MouseButtons.Left)
|
||||
{
|
||||
WaterSelectColor = true;
|
||||
_waterSelectColor = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
WaterSelectColor = false;
|
||||
_waterSelectColor = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -866,10 +685,6 @@ public partial class MainForm
|
|||
}
|
||||
}
|
||||
|
||||
private void TextBox27_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
private void CheckBox18_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
CheckBox4.Checked = false;
|
||||
|
|
@ -912,8 +727,6 @@ public partial class MainForm
|
|||
ProgressBar1.Step = 1;
|
||||
ProgressBar1.Value = 0;
|
||||
|
||||
// Await CreaCatalogoParallel()
|
||||
|
||||
var imageCreationOptions = new ImageCreationStuff.Options
|
||||
{
|
||||
AggiornaSottodirectory = chkAggiornaSottodirectory.Checked,
|
||||
|
|
@ -924,8 +737,8 @@ public partial class MainForm
|
|||
NumerazioneType = GetNumerazioneEnum(),
|
||||
SourcePath = Model.SourcePath,
|
||||
DestinationPath = Model.DestinationPath,
|
||||
MaxThreads = int.Parse(TextBox7.Text),
|
||||
ChunksSize = int.Parse(TextBox8.Text),
|
||||
MaxThreads = Model.ThreadsCount,
|
||||
ChunksSize = Model.ChunkSize,
|
||||
LinearExecution = rdbVecchioMetodo.Checked
|
||||
};
|
||||
|
||||
|
|
@ -939,7 +752,7 @@ public partial class MainForm
|
|||
timer1.Interval = 1000 * 60;
|
||||
timer1.Enabled = true;
|
||||
|
||||
string time =
|
||||
var time =
|
||||
await _imageCreationService.CreaCatalogoParallel(imageCreationOptions, _results, UiUpdateEvent, token);
|
||||
Model.SpeedCounter = time;
|
||||
timer1.Enabled = false;
|
||||
|
|
@ -969,7 +782,6 @@ public partial class MainForm
|
|||
_currentAmount = _results.Count;
|
||||
int diff = _currentAmount - _previousAmount;
|
||||
Model.SpeedCounter = $"{diff} f/m";
|
||||
//SetText(Label43, $"{diff} f/m");
|
||||
}
|
||||
|
||||
private void UpdateCounter(string text)
|
||||
|
|
|
|||
|
|
@ -120,12 +120,6 @@
|
|||
<metadata name="bindingSource1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>586, 17</value>
|
||||
</metadata>
|
||||
<metadata name="bindingSource1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>586, 17</value>
|
||||
</metadata>
|
||||
<metadata name="dataModelBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>120, 17</value>
|
||||
</metadata>
|
||||
<metadata name="dataModelBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>120, 17</value>
|
||||
</metadata>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue